Skip to content

Commit

Permalink
fix(storybook): container width, stories width
Browse files Browse the repository at this point in the history
  • Loading branch information
tay1orjones committed Jul 26, 2019
1 parent cd5fcf5 commit b027854
Show file tree
Hide file tree
Showing 4 changed files with 230,648 additions and 231,345 deletions.
5 changes: 3 additions & 2 deletions .storybook/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ import '../src/index.scss';
export default class Container extends Component {
render() {
const { story } = this.props;
console.log(story);

return (
<div
className="storybook-container"
style={{
padding: '3em',
padding: '3rem',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
}}
>
<div style={{ width: '100%' }}>{story()}</div>
{story()}
</div>
);
}
Expand Down
22 changes: 12 additions & 10 deletions src/components/Table/Table.story.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,13 @@ const RowExpansionContent = ({ rowId }) => (

const StyledTableWidth = styled.div`
&&& {
width: 95vw;
width: calc(100vw - 6rem);
}
`;

const StyledTableCustomRowHeight = styled(Table)`
&&& {
width: 95vw;
width: calc(100vw - 6rem);
& tr {
height: 5rem;
}
Expand Down Expand Up @@ -1081,14 +1081,16 @@ storiesOf('Watson IoT|Table', module)
'with fixed column width',
() => (
// You don't need to use styled components, just pass a className to the Table component and use selectors to find the correct column
<Table
columns={tableColumns.map((i, idx) => ({
width: idx % 2 === 0 ? '20rem' : '10rem',
...i,
}))}
data={tableData}
actions={actions}
/>
<div style={{ width: 'calc(100vw - 6rem)' }}>
<Table
columns={tableColumns.map((i, idx) => ({
width: idx % 2 === 0 ? '20rem' : '10rem',
...i,
}))}
data={tableData}
actions={actions}
/>
</div>
),
{
info: {
Expand Down
6 changes: 5 additions & 1 deletion src/components/TileCatalog/TileCatalog.story.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { callbackify } from 'util';

import React, { useState, useEffect } from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
Expand Down Expand Up @@ -93,7 +95,9 @@ storiesOf('Watson IoT|TileCatalog', module)
))
.add('loading', () => <StatefulTileCatalog {...commonTileCatalogProps} isLoading />)
.add('error', () => (
<StatefulTileCatalog {...commonTileCatalogProps} tiles={[]} error="In error state" />
<div style={{ width: 'calc(100vw - 6rem)' }}>
<StatefulTileCatalog {...commonTileCatalogProps} tiles={[]} error="In error state" />
</div>
))
.add('async loaded wait one second', () => {
const Container = () => {
Expand Down
Loading

0 comments on commit b027854

Please sign in to comment.