aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/@next/components
diff options
context:
space:
mode:
authorFred Carlsen <fred@sjelfull.no>2018-11-30 19:05:08 +0800
committerFred Carlsen <fred@sjelfull.no>2018-11-30 19:05:08 +0800
commitfff4dd7e947f7f66e0854dea5d192c72b9e3d674 (patch)
tree64e8d3577ddb61f50df046d3ee9a5a735da6e815 /packages/website/ts/@next/components
parentc2d958515009967a6802a06e47f454e12d15a7fe (diff)
downloaddexon-0x-contracts-fff4dd7e947f7f66e0854dea5d192c72b9e3d674.tar.gz
dexon-0x-contracts-fff4dd7e947f7f66e0854dea5d192c72b9e3d674.tar.zst
dexon-0x-contracts-fff4dd7e947f7f66e0854dea5d192c72b9e3d674.zip
Export svgs as typed pure components
Diffstat (limited to 'packages/website/ts/@next/components')
-rw-r--r--packages/website/ts/@next/components/icon.tsx21
-rw-r--r--packages/website/ts/@next/components/logo.tsx6
2 files changed, 15 insertions, 12 deletions
diff --git a/packages/website/ts/@next/components/icon.tsx b/packages/website/ts/@next/components/icon.tsx
index 10916f28e..112d4ed68 100644
--- a/packages/website/ts/@next/components/icon.tsx
+++ b/packages/website/ts/@next/components/icon.tsx
@@ -3,20 +3,23 @@ import styled from 'styled-components';
interface Props {
icon: any;
- size?: any;
+ size?: string;
}
-const StyledIcon = styled.div`
+export const IconClass: React.FunctionComponent<Props> = (props: Props) => {
+ const { icon, size } = props;
+
+ return (
+ <div />
+ );
+};
+
+export const Icon = styled(IconClass)`
margin: auto;
flex-shrink: 0;
${(props: Props) => props.size && `
- width: ${props.size}; height: auto;
+ width: ${props.size};
+ height: auto;
`}
`;
-
-export const Icon: React.StatelessComponent = ({ icon, ...props }) => (
- <>
- <StyledIcon as={icon as 'svg'} {...props} />
- </>
-);
diff --git a/packages/website/ts/@next/components/logo.tsx b/packages/website/ts/@next/components/logo.tsx
index 59db7d0ec..1a02e211e 100644
--- a/packages/website/ts/@next/components/logo.tsx
+++ b/packages/website/ts/@next/components/logo.tsx
@@ -1,7 +1,7 @@
import * as React from 'react';
import styled from 'styled-components';
-import logoWithType from '../icons/logo-with-type.svg';
+import LogoIcon from '../icons/logo-with-type.svg';
interface LogoInterface {
// showType: boolean;
@@ -11,12 +11,12 @@ const StyledLogo = styled.div`
text-align: left;
`;
-const Icon = styled.div`
+const Icon = styled(LogoIcon)`
flex-shrink: 0;
`;
export const Logo: React.StatelessComponent<LogoInterface> = ({}) => (
<StyledLogo>
- <Icon as={logoWithType as 'svg'} />
+ <Icon />
</StyledLogo>
);