-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
92 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from 'react' | ||
import PropTypes from 'prop-types' | ||
|
||
import styles from './Link.module.css' | ||
import { options } from './constants' | ||
import withStyles from '../../hocs/withStyles' | ||
|
||
import Paragraph from '../Paragraph' | ||
|
||
export const Link = ({ children, color, getStyles }) => { | ||
return ( | ||
<a className={getStyles('link', ['color'])}> | ||
<Paragraph color={color} weight="medium"> | ||
{children} | ||
</Paragraph> | ||
</a> | ||
) | ||
} | ||
|
||
Link.propTypes = { | ||
children: PropTypes.node.isRequired, | ||
getStyles: PropTypes.func.isRequired, | ||
color: PropTypes.oneOf(options.colors), | ||
} | ||
|
||
Link.defaultProps = { | ||
getStyles: () => {}, | ||
color: 'primary', | ||
} | ||
|
||
export default withStyles(styles)(Link) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.link { | ||
display: flex; | ||
border-bottom: 1px solid currentColor; | ||
cursor: pointer; | ||
} | ||
|
||
.color-primary { | ||
color: var(--color-primary); | ||
} | ||
|
||
.color-tertiary { | ||
color: var(--color-tertiary); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Link, styles, options } from '.' | ||
|
||
import { | ||
getTemplate, | ||
getListTemplate, | ||
getOptionsArgTypes, | ||
} from '../../helpers/storybook' | ||
|
||
const Template = getTemplate(Link, styles) | ||
const ListTemplate = getListTemplate(Link, styles) | ||
|
||
export default { | ||
title: 'Atoms/Link', | ||
component: Link, | ||
args: { | ||
children: 'Mouths Muil', | ||
}, | ||
argTypes: { | ||
colors: getOptionsArgTypes(options.colors), | ||
}, | ||
} | ||
|
||
export const Default = Template.bind({}) | ||
export const Colors = ListTemplate.bind({}) | ||
Colors.args = { items: options.colors.map((color) => ({ color })) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const options = { colors: ['primary', 'tertiary'] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { default, Link } from './Link' | ||
export { options } from './constants' | ||
export { default as styles } from './Link.module.css' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
export const options = { | ||
colors: ['base', 'muted', 'inverted'], | ||
colors: ['base', 'muted', 'inverted', 'primary', 'tertiary'], | ||
sizes: ['sm', 'md', 'lg'], | ||
weights: ['normal', 'medium'], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters