diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-11-10 07:26:57 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-11-10 07:26:57 +0800 |
commit | 433fb3597dc19cb223a2b8d0e373502042241abb (patch) | |
tree | dc9cccf7b1cc0d1c3d2d30986961e288fba4341e /packages/instant/src/components/ui/text.tsx | |
parent | 7460f2796a2a549eaed15051009e35229fb1280f (diff) | |
download | dexon-sol-tools-433fb3597dc19cb223a2b8d0e373502042241abb.tar.gz dexon-sol-tools-433fb3597dc19cb223a2b8d0e373502042241abb.tar.zst dexon-sol-tools-433fb3597dc19cb223a2b8d0e373502042241abb.zip |
feat: refactor button styles and add href to Text
Diffstat (limited to 'packages/instant/src/components/ui/text.tsx')
-rw-r--r-- | packages/instant/src/components/ui/text.tsx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/instant/src/components/ui/text.tsx b/packages/instant/src/components/ui/text.tsx index 4fe429d25..3dba11c74 100644 --- a/packages/instant/src/components/ui/text.tsx +++ b/packages/instant/src/components/ui/text.tsx @@ -2,6 +2,7 @@ import { darken } from 'polished'; import * as React from 'react'; import { ColorOption, styled } from '../../style/theme'; +import { util } from '../../util/util'; export interface TextProps { fontColor?: ColorOption; @@ -20,10 +21,16 @@ export interface TextProps { onClick?: (event: React.MouseEvent<HTMLElement>) => void; noWrap?: boolean; display?: string; + href?: string; } +export const Text: React.StatelessComponent<TextProps> = ({ href, onClick, ...rest }) => { + const computedOnClick = href ? util.createHrefOnClick(href) : onClick; + return <StyledText {...rest} onClick={computedOnClick} />; +}; + const darkenOnHoverAmount = 0.3; -export const Text = +export const StyledText = styled.div < TextProps > ` |