Skip to content

Commit

Permalink
M2-4969: define Banner icon SVGs as consts
Browse files Browse the repository at this point in the history
  • Loading branch information
farmerpaul committed Feb 5, 2024
1 parent 6460ce3 commit 3c20a59
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 10 additions & 0 deletions src/shared/components/Banners/Banner/Banner.const.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Svg } from 'shared/components/Svg';

const getSvg = (id: string) => <Svg id={id} width={32} height={32} />;

export const BANNER_ICONS = {
info: getSvg('more-info-filled'),
success: getSvg('check-circle'),
warning: getSvg('exclamation-circle'),
error: getSvg('exclamation-octagon'),
};
10 changes: 2 additions & 8 deletions src/shared/components/Banners/Banner/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Svg } from 'shared/components/Svg';
import { StyledClearedButton } from 'shared/styles';

import { BannerProps } from './Banner.types';
import { BANNER_ICONS } from './Banner.const';

export const Banner = ({
children,
Expand All @@ -32,12 +33,7 @@ export const Banner = ({

return (
<Alert
iconMapping={{
info: getSvg('more-info-filled'),
success: getSvg('check-circle'),
warning: getSvg('exclamation-circle'),
error: getSvg('exclamation-octagon'),
}}
iconMapping={BANNER_ICONS}
slots={{
closeButton: StyledClearedButton,
}}
Expand All @@ -55,5 +51,3 @@ export const Banner = ({
</Alert>
);
};

const getSvg = (id: string) => <Svg id={id} width={32} height={32} />;

0 comments on commit 3c20a59

Please sign in to comment.