-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(FlexBox): Replace withStyles HOC with forwardRef implementat…
…ion (#78)
- Loading branch information
1 parent
f75b30e
commit 0017fae
Showing
12 changed files
with
145 additions
and
91 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
12 changes: 12 additions & 0 deletions
12
packages/main/src/components/FlexBox/__snapshots__/FlexBox.test.tsx.snap
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,12 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`FlexBox with Custom Class Names and Style 1`] = ` | ||
<div | ||
class="FlexBox--flexBox- FlexBox--flexBoxDirectionRow- FlexBox--justifyContentStart- FlexBox--alignItemsStretch- FlexBox--flexWrapNoWrap- testClass" | ||
style="background-color: rgb(0, 0, 0);" | ||
> | ||
<span> | ||
Test 1 | ||
</span> | ||
</div> | ||
`; |
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 { boolean, select, text } from '@storybook/addon-knobs/'; | ||
import { storiesOf } from '@storybook/react'; | ||
import React from 'react'; | ||
import { FlexBox } from '../../lib/FlexBox'; | ||
import { FlexBoxAlignItems } from '../../lib/FlexBoxAlignItems'; | ||
import { FlexBoxDirection } from '../../lib/FlexBoxDirection'; | ||
import { FlexBoxJustifyContent } from '../../lib/FlexBoxJustifyContent'; | ||
import { FlexBoxWrap } from '../../lib/FlexBoxWrap'; | ||
import { Label } from '../../lib/Label'; | ||
|
||
storiesOf('Components | FlexBox', module).add('Default', () => ( | ||
<FlexBox | ||
justifyContent={select('justifyContent', FlexBoxJustifyContent, FlexBoxJustifyContent.Start)} | ||
alignItems={select('alignItems', FlexBoxAlignItems, FlexBoxAlignItems.Stretch)} | ||
direction={select('direction', FlexBoxDirection, FlexBoxDirection.Row)} | ||
wrap={select('wrap', FlexBoxWrap, FlexBoxWrap.NoWrap)} | ||
height={text('height', 'auto')} | ||
width={text('width', '500px')} | ||
displayInline={boolean('displayInline', false)} | ||
> | ||
<Label>Item 1</Label> | ||
<Label>Item 2</Label> | ||
<Label>Item 3</Label> | ||
<Label>Item 4</Label> | ||
<Label>Item 5</Label> | ||
</FlexBox> | ||
)); |
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,7 @@ | ||
export enum FlexBoxAlignItems { | ||
Start = 'Start', | ||
Center = 'Center', | ||
End = 'End', | ||
Baseline = 'Baseline', | ||
Stretch = 'Stretch' | ||
} |
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 @@ | ||
export enum FlexBoxDirection { | ||
Column = 'Column', | ||
ColumnReverse = 'ColumnReverse', | ||
Row = 'Row', | ||
RowReverse = 'RowReverse' | ||
} |
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,7 @@ | ||
export enum FlexBoxJustifyContent { | ||
Start = 'Start', | ||
Center = 'Center', | ||
End = 'End', | ||
SpaceAround = 'SpaceAround', | ||
SpaceBetween = 'SpaceBetween' | ||
} |
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,5 @@ | ||
export enum FlexBoxWrap { | ||
NoWrap = 'NoWrap', | ||
Wrap = 'Wrap', | ||
WrapReverse = 'WrapReverse' | ||
} |
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,3 @@ | ||
import { FlexBoxAlignItems } from '../components/FlexBox'; | ||
import { FlexBoxAlignItems } from '../enums/FlexBoxAlignItems'; | ||
|
||
export { FlexBoxAlignItems }; |
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,3 @@ | ||
import { FlexBoxDirection } from '../components/FlexBox'; | ||
import { FlexBoxDirection } from '../enums/FlexBoxDirection'; | ||
|
||
export { FlexBoxDirection }; |
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,3 @@ | ||
import { FlexBoxJustifyContent } from '../components/FlexBox'; | ||
import { FlexBoxJustifyContent } from '../enums/FlexBoxJustifyContent'; | ||
|
||
export { FlexBoxJustifyContent }; |
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,3 @@ | ||
import { FlexBoxWrap } from '../components/FlexBox'; | ||
import { FlexBoxWrap } from '../enums/FlexBoxWrap'; | ||
|
||
export { FlexBoxWrap }; |