This repository has been archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update cf-component-label to use Fela (#103)
* Updated the component as per new discussions * Fixed spaces in LabelTheme * Added new colors to color palette * Updated snapshots
- Loading branch information
Showing
8 changed files
with
80 additions
and
32 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
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,27 @@ | ||
import { rem } from 'polished'; | ||
|
||
export default baseTheme => { | ||
return { | ||
borderRadius: baseTheme.borderRadius, | ||
color: baseTheme.colorWhite, | ||
display: 'inline-block', | ||
fontSize: `${(parseFloat(baseTheme.fontSize) - 2) / parseFloat(baseTheme.fontSize)}rem`, | ||
fontWeight: baseTheme.weightSemiBold, | ||
lineHeight: baseTheme.rem, | ||
paddingTop: '0.26667em', | ||
paddingRight: '0.4em', | ||
paddingBottom: '0.26667em', | ||
paddingLeft: '0.4em', | ||
textTransform: 'uppercase', | ||
userSelect: 'none', | ||
verticalAlign: 'baseline', | ||
webkitTextStroke: 0, | ||
whiteSpace: 'nowrap', | ||
|
||
defaultBackgroundColor: baseTheme.color.cement, | ||
infoBackgroundColor: baseTheme.color.marine, | ||
successBackgroundColor: baseTheme.color.grass, | ||
warningBackgroundColor: baseTheme.color.tangerine, | ||
errorBackgroundColor: baseTheme.color.apple | ||
}; | ||
}; |
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,3 +1,8 @@ | ||
import Label from './Label'; | ||
import LabelUnstyled from './Label'; | ||
import LabelTheme from './LabelTheme'; | ||
|
||
export default Label; | ||
import { applyTheme } from 'cf-style-container'; | ||
|
||
const Label = applyTheme(LabelUnstyled, LabelTheme); | ||
|
||
export { Label, LabelTheme, LabelUnstyled }; |
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,15 +1,11 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import Label from '../../cf-component-label/src/index'; | ||
import felaTestContext from '../../../felaTestContext'; | ||
import { Label } from '../../cf-component-label/src/index'; | ||
|
||
test('should render', () => { | ||
const component = renderer.create(<Label type="default">A Label</Label>); | ||
expect(component.toJSON()).toMatchSnapshot(); | ||
}); | ||
|
||
test('should render with custom tagName', () => { | ||
const component = renderer.create( | ||
<Label type="default" tagName="small">A Label</Label> | ||
felaTestContext(<Label type="default">A Label</Label>) | ||
); | ||
expect(component.toJSON()).toMatchSnapshot(); | ||
}); |
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