mirror of
https://github.com/revoltchat/revite.git
synced 2025-01-15 08:51:27 -05:00
e1ffefe2ba
Fix svg alignment in foreign objects.
59 lines
1.1 KiB
TypeScript
59 lines
1.1 KiB
TypeScript
import { Attachment } from "revolt-api/types/Autumn";
|
|
import styled, { css } from "styled-components";
|
|
|
|
export interface IconBaseProps<T> {
|
|
target?: T;
|
|
attachment?: Attachment;
|
|
|
|
size: number;
|
|
hover?: boolean;
|
|
animate?: boolean;
|
|
}
|
|
|
|
interface IconModifiers {
|
|
square?: boolean;
|
|
hover?: boolean;
|
|
}
|
|
|
|
export default styled.svg<IconModifiers>`
|
|
flex-shrink: 0;
|
|
|
|
img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
|
|
${(props) =>
|
|
!props.square &&
|
|
css`
|
|
border-radius: 50%;
|
|
`}
|
|
}
|
|
|
|
${(props) =>
|
|
props.hover &&
|
|
css`
|
|
&:hover .icon {
|
|
filter: brightness(0.8);
|
|
}
|
|
`}
|
|
`;
|
|
|
|
export const ImageIconBase = styled.img<IconModifiers>`
|
|
flex-shrink: 0;
|
|
object-fit: cover;
|
|
|
|
${(props) =>
|
|
!props.square &&
|
|
css`
|
|
border-radius: 50%;
|
|
`}
|
|
|
|
${(props) =>
|
|
props.hover &&
|
|
css`
|
|
&:hover img {
|
|
filter: brightness(0.8);
|
|
}
|
|
`}
|
|
`;
|