Skip to content

Commit

Permalink
Refactoring & new features (#1)
Browse files Browse the repository at this point in the history
* refactor & fixes

- refactor & decomposition
- main parts of showcase UI now have `data-kind` attr
- it is possible now to customize colors of almost all UI parts

* deps upd

- watchStories now watch root dir instead glob of stories
  • Loading branch information
krutoo authored Jan 25, 2025
1 parent 7b16f5a commit 571b35b
Show file tree
Hide file tree
Showing 55 changed files with 3,130 additions and 3,586 deletions.
5 changes: 1 addition & 4 deletions .babel/plugin-add-js-ext-to-css-modules-imports.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import fs from 'node:fs';
import path from 'node:path';

export default function addJsExtToCssModulesImports() {
return {
visitor: {
Expand All @@ -25,7 +22,7 @@ export default function addJsExtToCssModulesImports() {
return;
}

if (!nodePath.node.source.value.endsWith('.m.css')) {
if (!nodePath.node.source.value.match(/(module|m)\.css$/i)) {
return;
}

Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ Currently only React is supported.

MDX also supported as a story module (if your bundler is configured).

### Key features

- any bundle supported
- ability to show extra source files for story
- ability to fully customize showcase page and sandbox page

## Installation

```bash
Expand Down Expand Up @@ -132,15 +138,15 @@ Create showcase entrypoint in your project, for example in `./src/showcase.jsx`:
// React bootstrap code
import { createRoot } from 'react-dom/client';

// "stories entrypoint" (this is an alias, more on that later)
import foundStories from '#found-stories';

// util for validate story-modules
import { filterValidStories } from '@krutoo/showcase/runtime';

// React component for showing documentation with all stories
// Standalone React component for showing documentation with all stories
import { ShowcaseApp } from '@krutoo/showcase/runtime-showcase';

// "stories entrypoint" (this is an alias, more on that later)
import foundStories from '#found-stories';

// import styles bundle
import '@krutoo/showcase/runtime-showcase/styles.css';

Expand Down Expand Up @@ -256,7 +262,7 @@ export default defineConfig(async () => {
},
resolve: {
alias: {
'#found-stories': path.resolve(process.cwd(), '.generated/entries.js'),
'#found-stories': path.resolve(process.cwd(), storiesConfig.filename),
},
},
plugins: [react()],
Expand Down
Loading

0 comments on commit 571b35b

Please sign in to comment.