diff --git a/packages/fuselage/src/components/Callout/Callout.stories.tsx b/packages/fuselage/src/components/Callout/Callout.stories.tsx index c0bbf3330f..82a6eceddb 100644 --- a/packages/fuselage/src/components/Callout/Callout.stories.tsx +++ b/packages/fuselage/src/components/Callout/Callout.stories.tsx @@ -81,3 +81,9 @@ Danger.args = { Danger.parameters = setStoryDescription( 'Communicates that an important aspect of the system is not working as expected and requires urgent action.' ); + +export const CustomIcon = Template.bind({}); +CustomIcon.args = { + title: 'This is a danger message', + icon: 'hash', +}; diff --git a/packages/fuselage/src/components/Callout/Callout.tsx b/packages/fuselage/src/components/Callout/Callout.tsx index 07e8098be6..bdfa90310b 100644 --- a/packages/fuselage/src/components/Callout/Callout.tsx +++ b/packages/fuselage/src/components/Callout/Callout.tsx @@ -8,10 +8,17 @@ type CalloutProps = Omit, 'type' | 'name'> & { type?: 'info' | 'success' | 'warning' | 'danger'; title?: ReactNode; children?: ReactNode; + icon?: ComponentProps['name']; }; -export const Callout = ({ children, title, type, ...props }: CalloutProps) => { - const iconName: 'info-circled' | 'checkmark-circled' | 'warning' | 'ban' = +export const Callout = ({ + type, + title, + children, + icon, + ...props +}: CalloutProps) => { + const defaultIcon = (type === 'info' && 'info-circled') || (type === 'success' && 'checkmark-circled') || (type === 'warning' && 'warning') || @@ -20,7 +27,7 @@ export const Callout = ({ children, title, type, ...props }: CalloutProps) => { return ( - + {title && (