aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/@next/components/icon.tsx
diff options
context:
space:
mode:
authorEzekiel Aquino <ezekiel@bakkenbaeck.no>2018-12-14 21:59:22 +0800
committerEzekiel Aquino <ezekiel@bakkenbaeck.no>2018-12-14 21:59:35 +0800
commitef403108fb0f5ed2798bc7eb59fa487c323ac1fb (patch)
treefdd7fd851deb74685bcd1fe602ddc505b1b9e6b6 /packages/website/ts/@next/components/icon.tsx
parent8a06dccbbf7e95b4223446cbd018f55b90214a62 (diff)
downloaddexon-sol-tools-ef403108fb0f5ed2798bc7eb59fa487c323ac1fb.tar.gz
dexon-sol-tools-ef403108fb0f5ed2798bc7eb59fa487c323ac1fb.tar.zst
dexon-sol-tools-ef403108fb0f5ed2798bc7eb59fa487c323ac1fb.zip
Edits CTA landing section
Diffstat (limited to 'packages/website/ts/@next/components/icon.tsx')
-rw-r--r--packages/website/ts/@next/components/icon.tsx33
1 files changed, 23 insertions, 10 deletions
diff --git a/packages/website/ts/@next/components/icon.tsx b/packages/website/ts/@next/components/icon.tsx
index 84d9f4cb4..e3ad83c94 100644
--- a/packages/website/ts/@next/components/icon.tsx
+++ b/packages/website/ts/@next/components/icon.tsx
@@ -5,20 +5,33 @@ import {getCSSPadding, PaddingInterface} from 'ts/@next/constants/utilities';
interface IconProps extends PaddingInterface {
name: string;
+ component?: React.ReactNode;
size?: 'small' | 'medium' | 'large' | 'hero' | number;
}
export const Icon: React.FunctionComponent<IconProps> = (props: IconProps) => {
- const IconSVG = Loadable({
- loader: () => import(/* webpackChunkName: "icon" */`ts/@next/icons/illustrations/${props.name}.svg`),
- loading: () => 'Loading',
- });
-
- return (
- <StyledIcon {...props}>
- <IconSVG />
- </StyledIcon>
- );
+ if (props.name && !props.component) {
+ const IconSVG = Loadable({
+ loader: () => import(/* webpackChunkName: "icon" */`ts/@next/icons/illustrations/${props.name}.svg`),
+ loading: () => 'Loading',
+ });
+
+ return (
+ <StyledIcon {...props}>
+ <IconSVG />
+ </StyledIcon>
+ );
+ }
+
+ if (props.component) {
+ return (
+ <StyledIcon {...props}>
+ {props.component}
+ </StyledIcon>
+ );
+ }
+
+ return null;
};
export const InlineIconWrap = styled.div<IconProps>`