From 0438f5ce399507b3b9d0ee1447691139f1ef9448 Mon Sep 17 00:00:00 2001 From: Anass Bouassaba Date: Wed, 13 Nov 2024 20:39:16 +0100 Subject: [PATCH] fix: ability to customize icon font size --- package.json | 2 +- src/components/icons.tsx | 518 ++++++++++++--------------------------- 2 files changed, 151 insertions(+), 369 deletions(-) diff --git a/package.json b/package.json index 0d43544..0d0fc02 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@koupr/ui", - "version": "1.10.9", + "version": "1.10.10", "license": "MIT", "type": "module", "source": "src/index.ts", diff --git a/src/components/icons.tsx b/src/components/icons.tsx index bad9d1b..53eb37f 100644 --- a/src/components/icons.tsx +++ b/src/components/icons.tsx @@ -1,506 +1,288 @@ -import { HTMLAttributes } from 'react' +import { CSSProperties, HTMLAttributes } from 'react' import { cx } from '@emotion/css' export type IconProps = { filled?: boolean + fontSize?: string } & HTMLAttributes -export const IconPlayArrow = ({ className, filled, ...props }: IconProps) => ( - - play_arrow - +export const IconPlayArrow = (props: IconProps) => ( + play_arrow ) -export const IconUpload = ({ className, filled, ...props }: IconProps) => ( - - upload - +export const IconUpload = (props: IconProps) => ( + upload ) -export const IconAdminPanelSettings = ({ - className, - filled, - ...props -}: IconProps) => ( - - admin_panel_settings - +export const IconAdminPanelSettings = (props: IconProps) => ( + admin_panel_settings ) -export const IconDatabase = ({ className, filled, ...props }: IconProps) => ( - - database - +export const IconDatabase = (props: IconProps) => ( + database ) -export const IconRemoveOperator = ({ - className, - filled, - ...props -}: IconProps) => ( - - remove_moderator - +export const IconRemoveOperator = (props: IconProps) => ( + remove_moderator ) -export const IconNotifications = ({ - className, - filled, - ...props -}: IconProps) => ( - - notifications - +export const IconNotifications = (props: IconProps) => ( + notifications ) -export const IconMoreVert = ({ className, filled, ...props }: IconProps) => ( - - more_vert - +export const IconMoreVert = (props: IconProps) => ( + more_vert ) -export const IconLogout = ({ className, filled, ...props }: IconProps) => ( - - logout - +export const IconLogout = (props: IconProps) => ( + logout ) -export const IconChevronLeft = ({ className, filled, ...props }: IconProps) => ( - - chevron_left - +export const IconChevronLeft = (props: IconProps) => ( + chevron_left ) -export const IconChevronRight = ({ - className, - filled, - ...props -}: IconProps) => ( - - chevron_right - +export const IconChevronRight = (props: IconProps) => ( + chevron_right ) -export const IconChevronDown = ({ className, filled, ...props }: IconProps) => ( - - keyboard_arrow_down - +export const IconChevronDown = (props: IconProps) => ( + keyboard_arrow_down ) -export const IconChevronUp = ({ className, filled, ...props }: IconProps) => ( - - keyboard_arrow_up - +export const IconChevronUp = (props: IconProps) => ( + keyboard_arrow_up ) -export const IconAdd = ({ className, filled, ...props }: IconProps) => ( - - add - -) +export const IconAdd = (props: IconProps) => add -export const IconEdit = ({ className, filled, ...props }: IconProps) => ( - - edit - -) +export const IconEdit = (props: IconProps) => edit -export const IconGroup = ({ className, filled, ...props }: IconProps) => ( - - group - +export const IconGroup = (props: IconProps) => ( + group ) -export const IconDownload = ({ className, filled, ...props }: IconProps) => ( - - download - +export const IconDownload = (props: IconProps) => ( + download ) -export const IconArrowTopRight = ({ - className, - filled, - ...props -}: IconProps) => ( - - arrow_top_right - +export const IconArrowTopRight = (props: IconProps) => ( + arrow_top_right ) -export const IconFileCopy = ({ className, filled, ...props }: IconProps) => ( - - file_copy - +export const IconFileCopy = (props: IconProps) => ( + file_copy ) -export const IconDelete = ({ className, filled, ...props }: IconProps) => ( - - delete - +export const IconDelete = (props: IconProps) => ( + delete ) -export const IconSend = ({ className, filled, ...props }: IconProps) => ( - - send - -) +export const IconSend = (props: IconProps) => send -export const IconPersonAdd = ({ className, filled, ...props }: IconProps) => ( - - person_add - +export const IconPersonAdd = (props: IconProps) => ( + person_add ) -export const IconPerson = ({ className, filled, ...props }: IconProps) => ( - - person - +export const IconPerson = (props: IconProps) => ( + person ) -export const IconCheck = ({ className, filled, ...props }: IconProps) => ( - - check - +export const IconCheck = (props: IconProps) => ( + check ) -export const IconLibraryAddCheck = ({ - className, - filled, - ...props -}: IconProps) => ( - - library_add_check - +export const IconLibraryAddCheck = (props: IconProps) => ( + library_add_check ) -export const IconSelectCheckBox = ({ - className, - filled, - ...props -}: IconProps) => ( - - select_check_box - +export const IconSelectCheckBox = (props: IconProps) => ( + select_check_box ) -export const IconCheckBoxOutlineBlank = ({ - className, - filled, - ...props -}: IconProps) => ( - - check_box_outline_blank - +export const IconCheckBoxOutlineBlank = (props: IconProps) => ( + check_box_outline_blank ) -export const IconCheckCircle = ({ className, filled, ...props }: IconProps) => ( - - check_circle - +export const IconCheckCircle = (props: IconProps) => ( + check_circle ) -export const IconError = ({ className, filled, ...props }: IconProps) => ( - - error - +export const IconError = (props: IconProps) => ( + error ) -export const IconWarning = ({ className, filled, ...props }: IconProps) => ( - - warning - +export const IconWarning = (props: IconProps) => ( + warning ) -export const IconInvitations = ({ className, filled, ...props }: IconProps) => ( - - forward_to_inbox - +export const IconInvitations = (props: IconProps) => ( + forward_to_inbox ) -export const IconWorkspaces = ({ className, filled, ...props }: IconProps) => ( - - workspaces - +export const IconWorkspaces = (props: IconProps) => ( + workspaces ) -export const IconFlag = ({ className, filled, ...props }: IconProps) => ( - - flag - -) +export const IconFlag = (props: IconProps) => flag -export const IconClose = ({ className, filled, ...props }: IconProps) => ( - - close - +export const IconClose = (props: IconProps) => ( + close ) -export const IconSchedule = ({ className, filled, ...props }: IconProps) => ( - - schedule - +export const IconSchedule = (props: IconProps) => ( + schedule ) -export const IconClearAll = ({ className, filled, ...props }: IconProps) => ( - - clear_all - +export const IconClearAll = (props: IconProps) => ( + clear_all ) -export const IconOpenInNew = ({ className, filled, ...props }: IconProps) => ( - - open_in_new - +export const IconOpenInNew = (props: IconProps) => ( + open_in_new ) -export const IconInfo = ({ className, filled, ...props }: IconProps) => ( - - info - -) +export const IconInfo = (props: IconProps) => info -export const IconSearch = ({ className, filled, ...props }: IconProps) => ( - - search - +export const IconSearch = (props: IconProps) => ( + search ) -export const IconRefresh = ({ className, filled, ...props }: IconProps) => ( - - refresh - +export const IconRefresh = (props: IconProps) => ( + refresh ) -export const IconSync = ({ className, filled, ...props }: IconProps) => ( - - sync - -) +export const IconSync = (props: IconProps) => sync -export const IconGridView = ({ className, filled, ...props }: IconProps) => ( - - grid_view - +export const IconGridView = (props: IconProps) => ( + grid_view ) -export const IconArrowUpward = ({ className, filled, ...props }: IconProps) => ( - - arrow_upward - +export const IconArrowUpward = (props: IconProps) => ( + arrow_upward ) -export const IconArrowDownward = ({ - className, - filled, - ...props -}: IconProps) => ( - - arrow_downward - +export const IconArrowDownward = (props: IconProps) => ( + arrow_downward ) -export const IconExpandMore = ({ className, filled, ...props }: IconProps) => ( - - expand_more - +export const IconExpandMore = (props: IconProps) => ( + expand_more ) -export const IconList = ({ className, filled, ...props }: IconProps) => ( - - list - -) +export const IconList = (props: IconProps) => list -export const IconHourglass = ({ className, filled, ...props }: IconProps) => ( - - hourglass - +export const IconHourglass = (props: IconProps) => ( + hourglass ) -export const IconKeyboardArrowLeft = ({ - className, - filled, - ...props -}: IconProps) => ( - - keyboard_arrow_left - +export const IconKeyboardArrowLeft = (props: IconProps) => ( + keyboard_arrow_left ) -export const IconKeyboardArrowRight = ({ - className, - filled, - ...props -}: IconProps) => ( - - keyboard_arrow_right - +export const IconKeyboardArrowRight = (props: IconProps) => ( + keyboard_arrow_right ) -export const IconKeyboardDoubleArrowRight = ({ - className, - filled, - ...props -}: IconProps) => ( - - keyboard_double_arrow_right - +export const IconKeyboardDoubleArrowRight = (props: IconProps) => ( + keyboard_double_arrow_right ) -export const IconKeyboardDoubleArrowLeft = ({ - className, - filled, - ...props -}: IconProps) => ( - - keyboard_double_arrow_left - +export const IconKeyboardDoubleArrowLeft = (props: IconProps) => ( + keyboard_double_arrow_left ) -export const IconFirstPage = ({ className, filled, ...props }: IconProps) => ( - - first_page - +export const IconFirstPage = (props: IconProps) => ( + first_page ) -export const IconLastPage = ({ className, filled, ...props }: IconProps) => ( - - last_page - +export const IconLastPage = (props: IconProps) => ( + last_page ) -export const IconHistory = ({ className, filled, ...props }: IconProps) => ( - - history - +export const IconHistory = (props: IconProps) => ( + history ) -export const IconModeHeat = ({ className, filled, ...props }: IconProps) => ( - - mode_heat - +export const IconModeHeat = (props: IconProps) => ( + mode_heat ) -export const IconSecurity = ({ className, filled, ...props }: IconProps) => ( - - security - +export const IconSecurity = (props: IconProps) => ( + security ) -export const IconVisibility = ({ className, filled, ...props }: IconProps) => ( - - visibility - +export const IconVisibility = (props: IconProps) => ( + visibility ) -export const IconTune = ({ className, filled, ...props }: IconProps) => ( - - tune - -) +export const IconTune = (props: IconProps) => tune -export const IconHome = ({ className, filled, ...props }: IconProps) => ( - - home - -) +export const IconHome = (props: IconProps) => home -export const IconStacks = ({ className, filled, ...props }: IconProps) => ( - - stacks - +export const IconStacks = (props: IconProps) => ( + stacks ) -export const IconCloudUpload = ({ className, filled, ...props }: IconProps) => ( - - cloud_upload - +export const IconCloudUpload = (props: IconProps) => ( + cloud_upload ) -export const IconBolt = ({ className, filled, ...props }: IconProps) => ( - - bolt - -) +export const IconBolt = (props: IconProps) => bolt -export const IconChat = ({ className, filled, ...props }: IconProps) => ( - - chat - +export const IconChat = (props: IconProps) => chat + +export const IconFavorite = (props: IconProps) => ( + favorite ) -export const IconFavorite = ({ className, filled, ...props }: IconProps) => ( - - favorite - +export const IconWhatshot = (props: IconProps) => ( + whatshot ) -export const IconWhatshot = ({ className, filled, ...props }: IconProps) => ( - - whatshot - +export const IconSwapVerticalCircle = (props: IconProps) => ( + swap_vertical_circle ) -export const IconSwapVerticalCircle = ({ - className, - filled, - ...props -}: IconProps) => ( - - swap_vertical_circle - +export const IconFrontHand = (props: IconProps) => ( + front_hand ) -export const IconFrontHand = ({ className, filled, ...props }: IconProps) => ( - - front_hand - +export const IconHandshake = (props: IconProps) => ( + handshake ) -export const IconHandshake = ({ className, filled, ...props }: IconProps) => ( - - handshake - +export const IconRemoveModerator = (props: IconProps) => ( + remove_moderator ) -export const IconRemoveModerator = ({ - className, - filled, - ...props -}: IconProps) => ( - - remove_moderator - +export const IconShield = (props: IconProps) => ( + shield ) -export const IconShield = ({ className, filled, ...props }: IconProps) => ( - - shield - +export const IconThumbUp = (props: IconProps) => ( + thumb_up ) -export const IconThumbUp = ({ className, filled, ...props }: IconProps) => ( - - thumb_up - +export const IconThumbDown = (props: IconProps) => ( + thumb_down ) -export const IconThumbDown = ({ className, filled, ...props }: IconProps) => ( - - thumb_down +type WrapperProps = { + children?: React.ReactNode + styles?: CSSProperties +} & IconProps + +const Wrapper = ({ className, filled, children, ...props }: WrapperProps) => ( + + {children} ) - -type GetClassNameOptions = { - filled?: boolean - className?: string -} - -function getClassName({ filled, className }: GetClassNameOptions) { - return cx( - 'koupr-material-symbols-rounded', - { 'koupr-material-symbols-rounded__filled': filled }, - 'koupr-text-[16px]', - className, - ) -}