Skip to content

Commit

Permalink
Merge pull request #265 from web3ui/bugfix/illustration/cudtom/sizing
Browse files Browse the repository at this point in the history
feat: added story and sizing on illustration components
  • Loading branch information
rayyan224 authored Mar 10, 2022
2 parents a11c924 + 1bb0bab commit dfd3cac
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/components/Illustrations/Illustration.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,10 @@ export const Bundle = Template.bind({});
Bundle.args = {
logo: 'bundle',
};

export const CustomSizing = Template.bind({});
CustomSizing.args = {
logo: 'comingSoon',
width: '150px',
height: '150px',
};
8 changes: 6 additions & 2 deletions src/components/Illustrations/Illustration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,15 @@ const getLogo = (logo: Chain | Logo, width?: Size, height?: Size) => {
}
};

const StyledIllustration = styled.div`
const StyledIllustration = styled.div<
Pick<IllustrationProps, 'width' | 'height'>
>`
${resetCSS}
display: flex;
justify-content: center;
align-items: center;
width: ${(props) => props.width};
height: ${(props) => props.height};
`;

const Illustration: React.FC<IllustrationProps> = ({
Expand All @@ -72,7 +76,7 @@ const Illustration: React.FC<IllustrationProps> = ({
height,
}: IllustrationProps) => {
return (
<StyledIllustration id={id}>
<StyledIllustration width={width} height={height} id={id}>
{getLogo(logo, width, height)}
</StyledIllustration>
);
Expand Down
7 changes: 7 additions & 0 deletions src/components/Illustrations/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ export interface IllustrationProps {
*/
logo: Chain | Logo;

/**
* Height of Illustration
*/
width?: Size;

/**
* Width of illustration
*/
height?: Size;
}

0 comments on commit dfd3cac

Please sign in to comment.