circle element
This commit is contained in:
1 parent
d848a3738b
commit
146a48b7c3
8 files changed
+152
-31
No files matched your search
@@ -2,36 +2,38 @@ import { createAppUseStyles } from 'styles/theme';
|
||||
import { AnchorHTMLAttributes, FC } from "react";
|
||||
|
||||
|
||||
|
||||
export const useIconStyles = createAppUseStyles<{size: number, color?: string}>(theme => ({
|
||||
icon: ({size}) => ({
|
||||
height: `${size}em`,
|
||||
width: `${size}em`,
|
||||
display: 'flex',
|
||||
}),
|
||||
svg: ({color=theme.primaryAccent}) => ({
|
||||
fill: color
|
||||
})
|
||||
export type IconStyleProps = {
|
||||
size?: number;
|
||||
units?: 'em' | 'px' | '%';
|
||||
color?: string;
|
||||
}
|
||||
export const useIconStyles = createAppUseStyles<IconStyleProps>(theme => ({
|
||||
icon: ({ size, units = 'em' }) => ({
|
||||
height: `${size}${units}`,
|
||||
width: `${size}${units}`,
|
||||
display: 'flex',
|
||||
}),
|
||||
svg: ({ color = theme.primaryAccent }) => ({
|
||||
fill: color
|
||||
})
|
||||
}))
|
||||
|
||||
export type IconBaseProps = AnchorHTMLAttributes<HTMLAnchorElement> & {
|
||||
size?: number;
|
||||
color?: string;
|
||||
}
|
||||
export type IconBaseProps = AnchorHTMLAttributes<HTMLAnchorElement> & IconStyleProps;
|
||||
export const IconBase: FC<IconBaseProps & { viewBox: string }> = ({
|
||||
children,
|
||||
viewBox,
|
||||
size=1,
|
||||
color,
|
||||
className="",
|
||||
...props
|
||||
children,
|
||||
viewBox,
|
||||
size = 1,
|
||||
color,
|
||||
units,
|
||||
className = "",
|
||||
...props
|
||||
}) => {
|
||||
const {classes} = useIconStyles({ size, color });
|
||||
return <a className={`${classes.icon} ${className}`} {...props}>
|
||||
<svg className={classes.svg} version="1.1" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox={viewBox}>
|
||||
<g>
|
||||
{children}
|
||||
</g>
|
||||
</svg>
|
||||
</a>
|
||||
const { classes } = useIconStyles({ size, color, units, });
|
||||
return <a className={`${classes.icon} ${className}`} {...props}>
|
||||
<svg className={classes.svg} version="1.1" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox={viewBox}>
|
||||
<g>
|
||||
{children}
|
||||
</g>
|
||||
</svg>
|
||||
</a>
|
||||
}
|
||||
Reference in new issue
Block a user