Hover animation for home button.

Fix svg alignment in foreign objects.
This commit is contained in:
Paul
2021-08-03 15:37:19 +01:00
parent 9581a4df92
commit e1ffefe2ba
4 changed files with 27 additions and 3 deletions

View File

@@ -6,11 +6,13 @@ export interface IconBaseProps<T> {
attachment?: Attachment;
size: number;
hover?: boolean;
animate?: boolean;
}
interface IconModifiers {
square?: boolean;
hover?: boolean;
}
export default styled.svg<IconModifiers>`
@@ -27,6 +29,14 @@ export default styled.svg<IconModifiers>`
border-radius: 50%;
`}
}
${(props) =>
props.hover &&
css`
&:hover .icon {
filter: brightness(0.8);
}
`}
`;
export const ImageIconBase = styled.img<IconModifiers>`
@@ -38,4 +48,12 @@ export const ImageIconBase = styled.img<IconModifiers>`
css`
border-radius: 50%;
`}
${(props) =>
props.hover &&
css`
&:hover img {
filter: brightness(0.8);
}
`}
`;

View File

@@ -63,6 +63,7 @@ export default observer(
status,
animate,
mask,
hover,
children,
as,
...svgProps
@@ -79,6 +80,7 @@ export default observer(
{...svgProps}
width={size}
height={size}
hover={hover}
aria-hidden="true"
viewBox="0 0 32 32">
<foreignObject
@@ -86,6 +88,7 @@ export default observer(
y="0"
width="32"
height="32"
class="icon"
mask={mask ?? (status ? "url(#user)" : undefined)}>
{<img src={iconURL} draggable={false} loading="lazy" />}
</foreignObject>