diff options
author | Fabio Berger <me@fabioberger.com> | 2018-10-11 20:23:45 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-10-11 20:23:45 +0800 |
commit | 1cfcc82ea9869e14c1a1b78e1376c89fdbeb91f4 (patch) | |
tree | 48ef8716485c1b961b2494071f5a64f60ff42f29 /packages/instant/src/components/ui/text.tsx | |
parent | 6c9f7839c3948e60f2987f474bb2ad6457588fa3 (diff) | |
parent | 8941b6cee5b56fab6d3b89ac8a899f21d5c86350 (diff) | |
download | dexon-0x-contracts-1cfcc82ea9869e14c1a1b78e1376c89fdbeb91f4.tar.gz dexon-0x-contracts-1cfcc82ea9869e14c1a1b78e1376c89fdbeb91f4.tar.zst dexon-0x-contracts-1cfcc82ea9869e14c1a1b78e1376c89fdbeb91f4.zip |
Merge branch 'development' into dev-section-redesign
* development: (62 commits)
Fix linter error
Upgrade ethereum-types
Lint and update deps
Be more explicit with falsiness
Add type to cssRuleIfExists
Fix issue where we throw if non-numeric characters are used in input
Upgrade to more recent types, fix yarn.lock
[fix]: [testnet-faucet] Exit 1 on build fail
Explains tools we want them to use
Add note about button
Add dev-tools-pages bundles to gitignore
Improve README
Fix button and center
Increase max bundle size for instant
Add stuff
Initial project scaffolding
Change tslint config to remove conflicts with prettier
fix: [testnet-faucet] Signing of orders
Update the CHANGELOG
Add comments for expiryBuffer
...
Diffstat (limited to 'packages/instant/src/components/ui/text.tsx')
-rw-r--r-- | packages/instant/src/components/ui/text.tsx | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/packages/instant/src/components/ui/text.tsx b/packages/instant/src/components/ui/text.tsx new file mode 100644 index 000000000..9fb8ea26f --- /dev/null +++ b/packages/instant/src/components/ui/text.tsx @@ -0,0 +1,80 @@ +import { darken } from 'polished'; +import * as React from 'react'; + +import { ColorOption, styled } from '../../style/theme'; + +export interface TextProps { + fontColor?: ColorOption; + fontFamily?: string; + fontStyle?: string; + fontSize?: string; + opacity?: number; + letterSpacing?: string; + textTransform?: string; + lineHeight?: string; + className?: string; + minHeight?: string; + center?: boolean; + fontWeight?: number | string; + textDecorationLine?: string; + onClick?: (event: React.MouseEvent<HTMLElement>) => void; + hoverColor?: string; + noWrap?: boolean; + display?: string; +} + +const PlainText: React.StatelessComponent<TextProps> = ({ children, className, onClick }) => ( + <div className={className} onClick={onClick}> + {children} + </div> +); + +const darkenOnHoverAmount = 0.3; +export const Text = styled(PlainText)` + font-family: ${props => props.fontFamily}; + font-style: ${props => props.fontStyle}; + font-weight: ${props => props.fontWeight}; + font-size: ${props => props.fontSize}; + opacity: ${props => props.opacity}; + text-decoration-line: ${props => props.textDecorationLine}; + ${props => (props.lineHeight ? `line-height: ${props.lineHeight}` : '')}; + ${props => (props.center ? 'text-align: center' : '')}; + color: ${props => props.fontColor && props.theme[props.fontColor]}; + ${props => (props.minHeight ? `min-height: ${props.minHeight}` : '')}; + ${props => (props.onClick ? 'cursor: pointer' : '')}; + transition: color 0.5s ease; + ${props => (props.noWrap ? 'white-space: nowrap' : '')}; + ${props => (props.display ? `display: ${props.display}` : '')}; + ${props => (props.letterSpacing ? `letter-spacing: ${props.letterSpacing}` : '')}; + ${props => (props.textTransform ? `text-transform: ${props.textTransform}` : '')}; + &:hover { + ${props => + props.onClick + ? `color: ${props.hoverColor || darken(darkenOnHoverAmount, props.theme[props.fontColor || 'white'])}` + : ''}; + } +`; + +Text.defaultProps = { + fontFamily: 'Inter UI', + fontStyle: 'normal', + fontWeight: 400, + fontColor: ColorOption.black, + fontSize: '15px', + textDecorationLine: 'none', + noWrap: false, + display: 'inline-block', +}; + +Text.displayName = 'Text'; + +export const Title: React.StatelessComponent<TextProps> = props => <Text {...props} />; + +Title.defaultProps = { + fontSize: '20px', + fontWeight: 600, + opacity: 1, + fontColor: ColorOption.primaryColor, +}; + +Title.displayName = 'Title'; |