-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(catalog): storybook for each package & composed storybook #25
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
9c70405
Stencil controls + react wrapper + LERNA
alebinson b333cbc
few task are added in package.json
alebinson cb033ef
Material React wrappers
4a5fcb8
react core components compiled and partially used
alebinson 5bce657
control usage in conflicts-ui
9015934
theming priniples start
5ba2ed6
controls integratoin. styling
63bb259
typography config and usage
10b122f
refactor(catalog): storybook for each package & composed storybook
rannyeli 3536f31
fix(lint): linting integrated
b6e4b1f
fix(linting): react components
1427a1f
fix(compilation): core components
725500a
fix(lerna): more published packages
4aa8c2d
fix(publish): task added
09cdbfc
fix(lerna): tasks
fd40bdd
fix(lerna): package.json
ceac5b2
chore(publish): publish %s [ci skip]
1caf8c7
fix(index): lerna
f445ee2
fix(lerna): index
0312325
chore(publish): publish %s
2b8c936
fix(rename): mc prefix removed
ee59b13
fix(pkg): core
3f71462
Merge branch 'master' of https://github.com/MapColonies/shared-compon…
aab448f
fix(storybook): unneeded files
b0e4595
fix(rename): demoapps
6113a9b
fix(cleanup): unneeded storybooks remains
b625388
fix(pkg): script added
02e659d
chore(release): version bumped 1.0.0
bf51776
fix(readme): updated
edc2cb5
chore(publish): publish [by user]
ee29115
fix(prettier): all code is prettified
86ea34b
fix(prcomments): fixed
9ed4985
fix(tests): added tests infrastructure
rannyeli af28c51
Merge branch 'mc-wc-ui-components' of https://github.com/MapColonies/…
rannyeli 5277aaa
Merge pull request #28 from MapColonies/run-tests
rannyeli 0d93497
Merge branch 'mc-wc-ui-components' of https://github.com/MapColonies/…
rannyeli 670c8ae
fix(composed storybook): updated storybook
rannyeli 0bfa4d1
feat(react-core): added stories
rannyeli 3d47424
fix(catalog): fixed react-core docs
rannyeli 9390b9e
Merge remote-tracking branch 'origin/master' into catalog
rannyeli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,20 @@ | ||
import React from 'react'; | ||
import { Typography } from '@map-colonies/react-core/dist/typography'; | ||
import '@map-colonies/react-core/dist/typography/styles'; | ||
|
||
export default { | ||
title: 'Welcome' | ||
}; | ||
|
||
export const ToCatalog = () => <div> | ||
<Typography tag="div" style={{ margin: '16px 0' }} use="headline3"> | ||
Welcome to Map Colonies Catalog | ||
</Typography><br/> | ||
<Typography tag="div" style={{ margin: '16px 0' }} use="subtitle1"> | ||
Shared components for Map Colonies organization. | ||
</Typography> | ||
</div>; | ||
|
||
ToCatalog.story = { | ||
name: 'to Catalog', | ||
}; |
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,21 @@ | ||
module.exports = { | ||
stories: ['./Welcome.stories.js'], | ||
addons: [ | ||
'@storybook/addon-storysource', | ||
'@storybook/addon-actions', | ||
'@storybook/addon-knobs', | ||
'@storybook/addon-links', | ||
'@storybook/addon-docs', | ||
'storybook-dark-mode' | ||
], | ||
refs: { | ||
react_components: { | ||
title: "React Components", | ||
url: "http://localhost:9010" | ||
}, | ||
react_ui_components: { | ||
title: "React UI Components", | ||
url: "http://localhost:9011" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we publish story books? |
||
} | ||
} | ||
}; |
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 @@ | ||
import { addons } from '@storybook/addons'; | ||
import theme from './theme'; | ||
|
||
addons.setConfig({ | ||
theme, | ||
}); |
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,9 @@ | ||
import React from "react"; | ||
import { addParameters } from '@storybook/react'; | ||
import { themes } from '@storybook/theming'; | ||
|
||
addParameters({ | ||
docs: { | ||
theme: themes.dark, | ||
}, | ||
}); |
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,9 @@ | ||
import { create } from '@storybook/theming'; | ||
import logo from '../public/assets/logo.png'; | ||
|
||
export default create({ | ||
base: 'light', | ||
|
||
brandTitle: 'Map Colonies-Catalog', | ||
brandImage: logo, | ||
}); |
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,12 @@ | ||
module.exports = { | ||
stories: ['../src/**/*.stories.tsx'], | ||
addons: [ | ||
'@storybook/preset-create-react-app', | ||
'@storybook/addon-storysource', | ||
'@storybook/addon-actions', | ||
'@storybook/addon-knobs', | ||
'@storybook/addon-links', | ||
'@storybook/addon-docs', | ||
'storybook-dark-mode' | ||
], | ||
}; |
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 @@ | ||
import { addons } from '@storybook/addons'; | ||
import theme from './theme'; | ||
|
||
addons.setConfig({ | ||
theme, | ||
}); |
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,10 @@ | ||
<style> | ||
#story--map--basic { | ||
height: 300px; | ||
position: relative; | ||
} | ||
#story--map--with-drawer { | ||
height: 300px; | ||
position: relative; | ||
} | ||
</style> |
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,20 @@ | ||
import React from "react"; | ||
import { addParameters, addDecorator } from '@storybook/react'; | ||
import { ThemeProvider, Themes } from '@map-colonies/react-core'; | ||
import { themes } from '@storybook/theming'; | ||
import { useDarkMode } from 'storybook-dark-mode'; | ||
import '@map-colonies/react-core/dist/rmwc/styles'; | ||
|
||
addParameters({ | ||
docs: { | ||
theme: themes.dark, | ||
}, | ||
}); | ||
|
||
addDecorator((story) => { | ||
const prefersDarkMode = useDarkMode(); | ||
const theme = prefersDarkMode ? Themes.darkTheme : Themes.lightTheme; | ||
return <ThemeProvider options={theme}> | ||
{story()} | ||
</ThemeProvider> | ||
}); |
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,9 @@ | ||
import { create } from '@storybook/theming'; | ||
import logo from '../../../public/assets/logo.png'; | ||
|
||
export default create({ | ||
base: 'light', | ||
|
||
brandTitle: 'Map Colonies-Catalog', | ||
brandImage: logo, | ||
}); |
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
14 changes: 14 additions & 0 deletions
14
packages/react-components/src/lib/date-range-picker/stories/DateRangePicker.stories.tsx
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,14 @@ | ||
import React from 'react'; | ||
import { action } from '@storybook/addon-actions'; | ||
import { DateTimeRangePicker } from '../date-range-picker'; | ||
|
||
export default { | ||
title: 'Picker', | ||
component: DateTimeRangePicker, | ||
}; | ||
|
||
export const DateTime = () => <DateTimeRangePicker onChange={action('date changed')}/>; | ||
|
||
DateTime.story = { | ||
name: 'Date time range', | ||
}; |
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
29 changes: 29 additions & 0 deletions
29
packages/react-components/src/lib/map-filter-container/stories/Map.stories.tsx
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,29 @@ | ||
import React from 'react'; | ||
import { ContainerMap } from '../container-map'; | ||
import { MapFilterContainer } from '../map-filter-container'; | ||
import { action } from '@storybook/addon-actions'; | ||
|
||
export default { | ||
title: 'Map', | ||
component: ContainerMap, | ||
parameters: { | ||
layout: 'fullscreen' | ||
} | ||
}; | ||
|
||
const mapDivStyle = { | ||
"height": "100%", | ||
"width": "100%", | ||
"position": "absolute" as const | ||
}; | ||
export const Basic = () => <div style={mapDivStyle}> | ||
<ContainerMap onPolygonSelection={action('shape selected')}/> | ||
</div>; | ||
|
||
export const withDrawer = () => <MapFilterContainer | ||
handlePolygonReset={action('vector source cleared')} | ||
handlePolygonSelected={action('shape selected')}/>; | ||
|
||
withDrawer.story = { | ||
name: 'with Drawer', | ||
}; |
33 changes: 33 additions & 0 deletions
33
packages/react-components/src/lib/map-filter-container/stories/Select.stories.tsx
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,33 @@ | ||
import React, { useState } from 'react'; | ||
import { PolygonSelectionUi } from '../polygon-selection-ui'; | ||
import { action } from '@storybook/addon-actions'; | ||
import { DrawType } from '../../models'; | ||
|
||
export default { | ||
title: 'Select', | ||
component: PolygonSelectionUi, | ||
}; | ||
|
||
export const PolygonBox = () => { | ||
const [active, setActive] = useState(false); | ||
|
||
const handleStartDraw = (type: DrawType) => { | ||
setActive(true); | ||
action('draw started')(type); | ||
}; | ||
|
||
const handleCancelDraw = () => { | ||
setActive(false); | ||
action('draw canceled')(); | ||
}; | ||
|
||
return <PolygonSelectionUi | ||
isSelectionEnabled={active} | ||
onStartDraw={handleStartDraw} | ||
onCancelDraw={handleCancelDraw} | ||
onReset={action('cleared')}/>; | ||
} | ||
|
||
PolygonBox.story = { | ||
name: 'Shape', | ||
}; |
102 changes: 102 additions & 0 deletions
102
packages/react-components/src/lib/smart-table/stories/SmartTable.stories.tsx
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,102 @@ | ||
import React, { useState } from 'react'; | ||
import { SmartTable, CellMetadata } from '..'; | ||
import { button } from '@storybook/addon-knobs'; | ||
import { action } from '@storybook/addon-actions'; | ||
|
||
export default { | ||
title: 'Smart Table', | ||
component: SmartTable, | ||
}; | ||
|
||
interface Person { | ||
firstName: string; | ||
lastName: string; | ||
age: number; | ||
birthday: string; | ||
} | ||
|
||
const metadata: CellMetadata<Person>[] = [ | ||
{ | ||
id: "firstName", | ||
label: "First Name", | ||
disablePadding: false, | ||
numeric: false, | ||
}, | ||
{ | ||
id: "lastName", | ||
label: "Last Name", | ||
disablePadding: false, | ||
numeric: false, | ||
}, | ||
{ | ||
id: "age", | ||
label: "Age", | ||
disablePadding: false, | ||
numeric: true, | ||
}, | ||
{ | ||
id: "birthday", | ||
label: "Birthday", | ||
disablePadding: false, | ||
numeric: false, | ||
}, | ||
]; | ||
|
||
const persons:Person[] = [ | ||
{ | ||
firstName: "Dan", | ||
lastName: "Walker", | ||
age: 24, | ||
birthday: "8-3-1996" | ||
}, | ||
{ | ||
firstName: "Emily", | ||
lastName: "Jhonson", | ||
age: 45, | ||
birthday: "13-5-1975" | ||
}, | ||
{ | ||
firstName: "Ron", | ||
lastName: "Elen", | ||
age: 13, | ||
birthday: "7-7-2007" | ||
}, | ||
{ | ||
firstName: "Michael", | ||
lastName: "Wall", | ||
age: 60, | ||
birthday: "28-9-1960" | ||
} | ||
]; | ||
|
||
const getRandomPerson = () => persons[Math.floor(Math.random() * persons.length)]; | ||
|
||
interface TableStroyProps { | ||
numberOfItems: number; | ||
} | ||
|
||
const TableStory: React.FC<TableStroyProps> = (props) => { | ||
const [rowsPerPage, setRowsPerPage] = useState(5); | ||
const [page, setPage] = useState(0); | ||
const [items, setItems] = useState([...new Array(props.numberOfItems)].map(getRandomPerson)); | ||
|
||
button("ADD ITEM", () => setItems([...items, getRandomPerson()])); | ||
button("REMOVE ITEM", () => setItems(items.slice(0, -1))); //remove last | ||
button("CLEAR TABLE", () => setItems([])); | ||
|
||
return <SmartTable | ||
rowsPerPage={rowsPerPage as (5 | 10)} | ||
handleChangePage={(e, newPage) => setPage(newPage)} | ||
handleChangeRowsPerPage={(e) => setRowsPerPage(+e.target.value)} | ||
page={page} | ||
count={items.length} | ||
items={items} | ||
isCollapseable={true} | ||
onRequestSort={action('sort requested')} | ||
cellsMetadata={metadata} | ||
onRowSelected={action('row selected')} | ||
isDense={true}/> | ||
}; | ||
|
||
export const Small = () => <TableStory numberOfItems={4}/> | ||
export const Large = () => <TableStory numberOfItems={60}/> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we publish story books?
http://localhost:9010
is for developmentThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we will publish them in the future, for now it's only for development