Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/uswitch/trustyle into for…
…m-and-panel-styling
- Loading branch information
Showing
15 changed files
with
267 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
**/* | ||
|
||
!lib/* | ||
!package.json | ||
!README.md | ||
!LICENSE |
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 @@ | ||
package-lock=false |
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,18 @@ | ||
{ | ||
"name": "@uswitch/trustyle.hero-card", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"main": "lib/index.js", | ||
"ts:main": "src/index.tsx", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"peerDependencies": { | ||
"@emotion/core": "^10.0.27", | ||
"react": "^16.7.0" | ||
}, | ||
"dependencies": { | ||
"@uswitch/trustyle-utils.get": "^1.0.5", | ||
"@uswitch/trustyle.button-link": "^1.0.3" | ||
} | ||
} |
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,52 @@ | ||
/** @jsx jsx */ | ||
|
||
import * as React from 'react' | ||
import { jsx, Styled } from 'theme-ui' | ||
import { ButtonLink } from '@uswitch/trustyle.button-link' | ||
|
||
interface Props extends React.HTMLAttributes<HTMLDivElement> { | ||
title: string | ||
ctaText: string | ||
children: React.ReactNode | ||
} | ||
|
||
const styles = (element?: string) => | ||
`compounds.heroCard.variants${element ? `.${element}` : ''}` | ||
|
||
const HeroCard: React.FC<Props> = ({ title, ctaText, children }) => { | ||
return ( | ||
<div | ||
sx={{ | ||
display: 'flex', | ||
variant: styles() | ||
}} | ||
> | ||
<div sx={{ variant: styles('flexContainer') }}> | ||
<Styled.h1>{title}</Styled.h1> | ||
<ButtonLink | ||
variant="primary" | ||
size="small" | ||
sx={{ variant: styles('buttonLink'), display: ['none', 'initial'] }} | ||
> | ||
{ctaText} | ||
</ButtonLink> | ||
</div> | ||
<div | ||
sx={{ | ||
variant: styles('links') | ||
}} | ||
> | ||
{children} | ||
</div> | ||
<ButtonLink | ||
variant="primary" | ||
size="small" | ||
sx={{ variant: styles('buttonLink'), display: ['initial', 'none'] }} | ||
> | ||
{ctaText} | ||
</ButtonLink> | ||
</div> | ||
) | ||
} | ||
|
||
export default HeroCard |
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,53 @@ | ||
/** @jsx jsx */ | ||
import * as React from 'react' | ||
import { jsx } from 'theme-ui' | ||
import { text } from '@storybook/addon-knobs' | ||
|
||
import AllThemes, { permutationsGenerator } from '../../../utils/all-themes' | ||
import { LinkList, LinkListItem } from '../../../elements/link-list/src' | ||
import { FilledArrow } from '../../../elements/icon/src/filled-arrow' | ||
|
||
import HeroCard from '.' | ||
|
||
export default { | ||
title: 'Compounds|HeroCard' | ||
} | ||
|
||
const title: string = text( | ||
'Headline', | ||
'Use a travel credit card to avoid spending fees abroad.' | ||
) | ||
const ctaText: string = text('CTA', 'Compare Credit Cards') | ||
const arrow = <FilledArrow color="" /> | ||
|
||
export const ExampleWithKnobs = () => { | ||
return ( | ||
<HeroCard ctaText={ctaText} title={title}> | ||
<LinkList variant="quickLinks"> | ||
<LinkListItem icon={arrow}>Car Insurance</LinkListItem> | ||
<LinkListItem icon={arrow}>Home Insurance</LinkListItem> | ||
<LinkListItem icon={arrow}>Income Protection Insurance</LinkListItem> | ||
</LinkList> | ||
</HeroCard> | ||
) | ||
} | ||
|
||
ExampleWithKnobs.story = { | ||
parameters: { | ||
percy: { skip: true } | ||
} | ||
} | ||
|
||
export const AutomatedTests = () => { | ||
const permutations = permutationsGenerator({ | ||
variant: ['primary'] | ||
}) | ||
|
||
return ( | ||
<AllThemes> | ||
{permutations.map((p, i) => ( | ||
<ExampleWithKnobs key={i} /> | ||
))} | ||
</AllThemes> | ||
) | ||
} |
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
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
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
Oops, something went wrong.