1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 08:19:40 +02:00

feat(ui): break css into module EE-3629 (#7180)

* break css into module and fix icon mode
This commit is contained in:
Richard Wei 2022-07-04 14:11:13 +12:00 committed by GitHub
parent 33861a834b
commit 69baa279d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 234 additions and 189 deletions

View file

@ -12,9 +12,22 @@ interface Props {
icon: ReactNode | ComponentType<unknown>;
feather?: boolean;
className?: string;
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
mode?:
| 'alt'
| 'primary'
| 'primary-alt'
| 'secondary'
| 'secondary-alt'
| 'warning'
| 'warning-alt'
| 'danger'
| 'danger-alt'
| 'success'
| 'success-alt';
}
export function Icon({ icon, feather, className }: Props) {
export function Icon({ icon, feather, className, mode, size }: Props) {
useEffect(() => {
if (feather) {
featherIcons.replace();
@ -31,11 +44,18 @@ export function Icon({ icon, feather, className }: Props) {
);
}
const classes = clsx(
className,
'icon',
{ [`icon-${mode}`]: mode },
{ [`icon-${size}`]: size }
);
if (feather) {
return (
<i
data-feather={icon}
className={className}
className={classes}
aria-hidden="true"
role="img"
/>