Skip to content

Commit

Permalink
(feat): add tooltip to backup images
Browse files Browse the repository at this point in the history
  • Loading branch information
Jipperism committed Mar 26, 2024
1 parent 6d731a3 commit 4b79271
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions components/hyperboard/Tile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ export const Tile = ({
justifyContent="center"
>
{showBackupImage ? (
<BackupForImage id={entry.id} fontSize={layout.font} />
<BackupForImage
id={entry.id}
fontSize={layout.font}
toolTipLabel={toolTipLabel}
/>
) : (
<Tooltip label={toolTipLabel} aria-label={toolTipLabel}>
<Image
Expand All @@ -79,7 +83,11 @@ export const Tile = ({
return (
<Wrapper {...wrapperProps}>
{showBackupImage ? (
<BackupForImage id={entry.id} fontSize={layout.font} />
<BackupForImage
id={entry.id}
fontSize={layout.font}
toolTipLabel={toolTipLabel}
/>
) : (
<Flex
width={"100%"}
Expand Down Expand Up @@ -171,7 +179,11 @@ export const Tile = ({
)}
</Flex>
{showBackupImage ? (
<BackupForImage id={entry.id} fontSize={layout.font} />
<BackupForImage
id={entry.id}
fontSize={layout.font}
toolTipLabel={toolTipLabel}
/>
) : (
<Tooltip label={toolTipLabel} aria-label={toolTipLabel}>
<Image
Expand All @@ -198,12 +210,24 @@ export const Tile = ({

return (
<Wrapper {...wrapperProps}>
<BackupForImage id={entry.id} fontSize={layout.font} />
<BackupForImage
id={entry.id}
fontSize={layout.font}
toolTipLabel={toolTipLabel}
/>
</Wrapper>
);
};

const BackupForImage = ({ id, fontSize }: { id: string; fontSize: number }) => {
const BackupForImage = ({
id,
fontSize,
toolTipLabel,
}: {
id: string;
fontSize: number;
toolTipLabel: string;
}) => {
const { data, isLoading } = useEnsName({
address: isAddress(id) ? id : undefined,
chainId: 1,
Expand All @@ -216,9 +240,11 @@ const BackupForImage = ({ id, fontSize }: { id: string; fontSize: number }) => {

return (
<Center height={"100%"} width={"100%"}>
<Text color="black" opacity={0.99} fontSize={fontSize}>
{data || fallback}
</Text>
<Tooltip label={toolTipLabel}>
<Text color="black" opacity={0.99} fontSize={fontSize}>
{data || fallback}
</Text>
</Tooltip>
</Center>
);
};
Expand Down

0 comments on commit 4b79271

Please sign in to comment.