diff --git a/app/assets/css/button.css b/app/assets/css/button.css index 37fe0ae96..eb7126e30 100644 --- a/app/assets/css/button.css +++ b/app/assets/css/button.css @@ -2,6 +2,7 @@ border-radius: 5px; display: inline-flex; justify-content: space-around; + align-items: center; gap: 5px; } diff --git a/app/assets/css/icon.css b/app/assets/css/icon.css index 93ab9fb40..73d06b4d8 100644 --- a/app/assets/css/icon.css +++ b/app/assets/css/icon.css @@ -12,31 +12,32 @@ pr-icon { .icon { color: currentColor; margin: 0; + + font-size: var(--icon-size); + height: var(--icon-size); + width: var(--icon-size); + + --icon-size: 1em; } .icon-xs { - height: 10px; - width: 10px; + --icon-size: 10px; } .icon-sm { - height: 14px; - width: 14px; + --icon-size: 14px; } .icon-md { - height: 16px; - width: 16px; + --icon-size: 16px; } .icon-lg { - height: 22px; - width: 22px; + --icon-size: 22px; } .icon-xl { - height: 26px; - width: 26px; + --icon-size: 26px; } .icon.icon-alt { diff --git a/app/react/components/Icon.tsx b/app/react/components/Icon.tsx index 52ef36c26..112c65ba9 100644 --- a/app/react/components/Icon.tsx +++ b/app/react/components/Icon.tsx @@ -9,7 +9,7 @@ export interface IconProps { } interface Props { - icon: ReactNode | ComponentType; + icon: ReactNode | ComponentType<{ size?: string | number }>; feather?: boolean; className?: string; size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'; @@ -34,23 +34,23 @@ export function Icon({ icon, feather, className, mode, size }: Props) { } }, [feather]); + const classes = clsx( + className, + 'icon', + { [`icon-${mode}`]: mode }, + { [`icon-${size}`]: size } + ); + if (typeof icon !== 'string') { const Icon = isValidElementType(icon) ? icon : null; return ( -