Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import './docs-root.css';
import '../packages/react-components/react-storybook-addon/src/styles.css';
import '../packages/react-components/react-storybook-addon-export-to-sandbox/src/styles.css';
import { withLinks } from '@storybook/addon-links';

Expand Down
24 changes: 0 additions & 24 deletions apps/public-docsite-v9/.storybook/docs-root-v9.css

This file was deleted.

2 changes: 0 additions & 2 deletions apps/public-docsite-v9/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import * as rootPreview from '../../../.storybook/preview';

import './docs-root-v9.css';

/** @type {NonNullable<import('@storybook/react').Decorator[]>} */
export const decorators = rootPreview.decorators;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "feat: add shared SB preview styles",
"packageName": "@fluentui/react-storybook-addon",
"email": "dmytrokirpa@microsoft.com",
"dependentChangeType": "patch"
}
9 changes: 9 additions & 0 deletions packages/react-components/react-storybook-addon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ export const ThemePicker: React.FC<{ context: FluentStoryContext }> = ({ context
};
```

### Shared Storybook Preview Styles

The package ships a `styles.css` file with shared Storybook preview styles (docs layout, table formatting, theme-aware backgrounds, etc.). Import it once in your Storybook `preview.js`/`preview.ts`:

```js
// .storybook/preview.js
import '@fluentui/react-storybook-addon/styles.css';
```

### Augmented Docs Blocks

This presets uses [custom docs container and page](https://storybook.js.org/docs/7/writing-docs/autodocs#customize-the-docs-container) for unified FluentUI experience including:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "lib-commonjs/index.js",
"module": "lib/index.js",
"typings": "./dist/index.d.ts",
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/microsoft/fluentui"
Expand Down Expand Up @@ -53,11 +52,16 @@
"require": "./lib-commonjs/index.js"
},
"./preset": "./preset.js",
"./styles.css": "./dist/styles.css",
"./package.json": "./package.json"
},
"sideEffects": [
"./dist/styles.css"
],
"files": [
"*.md",
"dist/*.d.ts",
"dist/styles.css",
"lib",
"lib-commonjs",
"preset.js"
Expand Down
11 changes: 10 additions & 1 deletion packages/react-components/react-storybook-addon/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@
],
"target": "build"
}
]
],
"options": {
"assets": [
{
"input": "{projectRoot}/src",
"output": "dist",
"glob": "styles.css"
}
]
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
padding: 0;
border-collapse: collapse;
}

#storybook-docs table:not(.docblock-argstable, .sbdocs-preview table) tr {
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
Expand Down Expand Up @@ -428,9 +429,11 @@ h1.fluent {

h1.fluent .fluent-version {
display: block;
font-size: 24px; /* --font-size-base-600 */
font-size: 24px;
/* --font-size-base-600 */
line-height: 32px;
color: #707070; /* --color-neutral-foreground-3 */
color: #707070;
/* --color-neutral-foreground-3 */
}

h2.fluent {
Expand All @@ -440,3 +443,28 @@ h2.fluent {
line-height: 36px;
letter-spacing: -0.16px;
}

/* remove the docs wrapper bg to let page bg show through */
/* remove unnecessary padding now that theme switcher is not taking up space */
#storybook-docs .sbdocs-wrapper {
background: transparent !important;
padding: 0 48px;
}

/* sb-show-main is missing during page transitions causing a page shift */
/* todo: cleanup once we no longer inherit docs-root */
.sb-show-main.sb-main-fullscreen,
.sb-main-fullscreen {
margin: 0;
padding: 0;
display: block;
}

/* remove loading overlay */
.sb-preparing-story,
.sb-preparing-docs,
.sb-nopreview,
.sb-errordisplay,
.sidebar-container .search-field + div {
display: none !important;
}
Loading