Skip to content

Commit

Permalink
feat: css
Browse files Browse the repository at this point in the history
  • Loading branch information
schummar committed Apr 17, 2023
1 parent 8047c6e commit 29e7d5a
Show file tree
Hide file tree
Showing 21 changed files with 16,287 additions and 25,995 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: npm

- name: Install dependencies
Expand Down
27 changes: 17 additions & 10 deletions docs/.storybook/main.cjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
const path = require('path');
const react = require('@vitejs/plugin-react');

module.exports = {
stories: ['../stories/**/*.stories.mdx', '../stories/**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-interactions'],
framework: '@storybook/react',
core: {
builder: '@storybook/builder-vite',
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-vite',
options: {},
},
features: {
storyStoreV7: true,
},
async viteFinal(config) {
config.plugins = config.plugins.filter((plugin) => !(Array.isArray(plugin) && plugin[0]?.name.includes('vite:react')));

config.plugins = config.plugins.filter(
(plugin) => !(Array.isArray(plugin) && plugin[0]?.name.includes('vite:react')),
);
config.plugins.push(
react({
exclude: [/\.stories\.(t|j)sx?$/, /node_modules/],
Expand All @@ -23,11 +27,14 @@ module.exports = {
},
}),
);

config.esbuild = {
logOverride: { 'this-is-undefined-in-esm': 'silent' },
logOverride: {
'this-is-undefined-in-esm': 'silent',
},
};

return config;
},
docs: {
// autodocs: true,
},
};
27 changes: 16 additions & 11 deletions docs/package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
{
"name": "docs",
"scripts": {
"start": "start-storybook -p 6006",
"build": "build-storybook"
"start": "storybook dev -p 6006",
"build": "storybook build"
},
"dependencies": {
"@babel/core": "7.21.0",
"@storybook/addon-actions": "6.5.16",
"@storybook/addon-essentials": "6.5.16",
"@storybook/addon-interactions": "6.5.16",
"@storybook/addon-links": "6.5.16",
"@storybook/builder-vite": "0.4.2",
"@storybook/react": "6.5.16",
"@storybook/testing-library": "0.0.13",
"babel-loader": "9.1.2",
"@material-ui/core": "4.12.4",
"@mui/material": "5.11.12",
"@types/react": "18.0.28"
"@storybook/addon-actions": "7.0.4",
"@storybook/addon-essentials": "7.0.4",
"@storybook/addon-interactions": "7.0.4",
"@storybook/addon-links": "7.0.4",
"@storybook/react": "7.0.4",
"@storybook/testing-library": "0.1.0",
"@types/react": "18.0.28",
"babel-loader": "9.1.2"
},
"devDependencies": {
"@storybook/react-vite": "^7.0.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "^7.0.4"
}
}
56 changes: 31 additions & 25 deletions docs/stories/aIntro.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,57 +1,50 @@
import type { ComponentMeta } from '@storybook/react';
import type { Meta } from '@storybook/react';
import { Table } from '../../src';
import css from './styles.module.css';
import data from './_data';
import { defaultColumns } from './_default';
import css from './styles.module.css';

// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
export default {
title: 'Intro',
component: Table,

// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
argTypes: {
classes: {
defaultValue: {
table: css.table,
},
},
items: {
defaultValue: data,
table: { disable: true },
},
id: {
defaultValue: 'id',
},
columns: {
defaultValue: defaultColumns,
},
virtual: {
defaultValue: true,
},
enableExport: {
defaultValue: true,
},
stickyHeader: {
defaultValue: true,
},
fullWidth: {
defaultValue: true,
options: [true, false, 'left', 'right'],
control: { type: 'inline-radio' },
},
},
} as ComponentMeta<typeof Table>;
} as Meta<typeof Table>;

export const Primary = {};
export const Primary = {
args: {
classes: { table: css.table },
items: data,
id: 'id',
columns: defaultColumns,
virtual: true,
enableExport: true,
stickyHeader: true,
fullWidth: true,
},
};

export const SortDisabledAll = {
args: {
...Primary.args,
disableSort: true,
},
};

export const SortDisabledOne = {
args: {
...Primary.args,
columns: defaultColumns.map((col, i) => ({
...col,
disableSort: i === 0,
Expand All @@ -61,16 +54,29 @@ export const SortDisabledOne = {

export const Persitance = {
args: {
...Primary.args,
persist: { storage: localStorage, id: 'tablePersistance' },
},
};

export const HiddenColumns = {
args: {
...Primary.args,
defaultHiddenColumns: new Set([1, 2]),
columns: defaultColumns.map((col, i) => ({
...col,
hidden: i === 0 ? false : i === 1 ? true : undefined,
})),
},
};

export const StyledCells = {
args: {
...Primary.args,
css: {
evenCell: {
backgroundColor: 'rgba(0, 0, 0, 0.05)',
},
},
},
};
Loading

0 comments on commit 29e7d5a

Please sign in to comment.