diff --git a/libs/tailwindcss-config/src/theme.js b/libs/tailwindcss-config/src/theme.js index d80221a69..5c95c29d2 100644 --- a/libs/tailwindcss-config/src/theme.js +++ b/libs/tailwindcss-config/src/theme.js @@ -82,6 +82,7 @@ module.exports = { 4: '0.25rem', 8: '0.5rem', 12: '0.75rem', + 20: '1.25rem', 28: '1.75rem', 44: '2.75rem', }, diff --git a/libs/ui-toolkit/src/components/icon/icon.spec.tsx b/libs/ui-toolkit/src/components/icon/icon.spec.tsx new file mode 100644 index 000000000..be593d3d2 --- /dev/null +++ b/libs/ui-toolkit/src/components/icon/icon.spec.tsx @@ -0,0 +1,10 @@ +import { render } from '@testing-library/react'; + +import Icon from './icon'; + +describe('Icon', () => { + it('should render successfully', () => { + const { baseElement } = render(); + expect(baseElement).toBeTruthy(); + }); +}); diff --git a/libs/ui-toolkit/src/components/icon/icon.stories.tsx b/libs/ui-toolkit/src/components/icon/icon.stories.tsx new file mode 100644 index 000000000..8f5843757 --- /dev/null +++ b/libs/ui-toolkit/src/components/icon/icon.stories.tsx @@ -0,0 +1,22 @@ +import { Story, Meta } from '@storybook/react'; +import { Icon } from './icon'; + +export default { + component: Icon, + title: 'Input', +} as Meta; + +const Template: Story = (args) => ; + +export const Default = Template.bind({}); +Default.args = {}; + +export const WithError = Template.bind({}); +WithError.args = { + hasError: true, +}; + +export const Disabled = Template.bind({}); +Disabled.args = { + disabled: true, +}; diff --git a/libs/ui-toolkit/src/components/icon/icon.tsx b/libs/ui-toolkit/src/components/icon/icon.tsx new file mode 100644 index 000000000..292102896 --- /dev/null +++ b/libs/ui-toolkit/src/components/icon/icon.tsx @@ -0,0 +1,32 @@ +import { IconSvgPaths20, IconSvgPaths16, IconName } from '@blueprintjs/icons'; +import classNames from 'classnames'; + +interface IconProps { + hasError?: boolean; + disabled?: boolean; + name: IconName; + className?: string; + size?: 16 | 20 | 24 | 32 | 48 | 64; +} + +export const Icon = ({ size = 20, name, className }: IconProps) => { + const effectiveClassName = classNames( + { + 'w-20': size === 20, + 'h-20': size === 20, + }, + className + ); + const viewbox = size <= 16 ? '0 0 16 16' : '0 0 20 20'; + return ( + + + {(size <= 16 ? IconSvgPaths16 : IconSvgPaths20)[name].map((d) => ( + + ))} + + + ); +}; + +export default Icon; diff --git a/libs/ui-toolkit/src/components/inputError/inputError.tsx b/libs/ui-toolkit/src/components/inputError/inputError.tsx index ea32598d9..2cfa7b8e8 100644 --- a/libs/ui-toolkit/src/components/inputError/inputError.tsx +++ b/libs/ui-toolkit/src/components/inputError/inputError.tsx @@ -1,4 +1,5 @@ import classNames from 'classnames'; +import Icon from '../icon/icon'; interface InputErrorProps { children?: React.ReactNode; @@ -27,7 +28,16 @@ export const InputError = ({ }, className ); - return
{children}
; + const iconClassName = classNames(['mx-8'], { + 'fill-intent-danger': intent === 'danger', + 'fill-intent-warning': intent === 'warning', + }); + return ( +
+ + {children} +
+ ); }; export default InputError;