revite/src/components/common/IconBase.tsx

42 lines
754 B
TypeScript
Raw Normal View History

2021-07-30 22:40:49 +01:00
import { Attachment } from "revolt-api/types/Autumn";
2021-06-19 12:34:53 +01:00
import styled, { css } from "styled-components";
export interface IconBaseProps<T> {
2021-07-05 11:25:20 +01:00
target?: T;
attachment?: Attachment;
2021-06-19 12:34:53 +01:00
2021-07-05 11:25:20 +01:00
size: number;
animate?: boolean;
2021-06-19 12:34:53 +01:00
}
2021-06-19 15:29:04 +01:00
interface IconModifiers {
2021-07-05 11:25:20 +01:00
square?: boolean;
2021-06-19 15:29:04 +01:00
}
export default styled.svg<IconModifiers>`
2021-07-05 11:25:20 +01:00
flex-shrink: 0;
img {
width: 100%;
height: 100%;
object-fit: cover;
${(props) =>
!props.square &&
css`
border-radius: 50%;
`}
}
2021-06-19 12:34:53 +01:00
`;
2021-06-19 15:29:04 +01:00
export const ImageIconBase = styled.img<IconModifiers>`
2021-07-05 11:25:20 +01:00
flex-shrink: 0;
object-fit: cover;
${(props) =>
!props.square &&
css`
border-radius: 50%;
`}
2021-06-19 15:29:04 +01:00
`;