Replies: 1 comment 2 replies
-
To add on top of the proposal, a possible concrete approach: In the DS, opt-into getting the default docs styles: {
"bkl": {
"docs": {
"default": true,
"styles": "./path/to/styles.css",
"prismTheme": "vsc-dark-plus"
}
}
} For new design systems we could provide a default config out of the box, for current design system they can opt-in so we don't break the looks of their docs when we release this. If you supply styles, it allows adding custom CSS to further enhance the docs styles. If you turn off default by setting it to false, it will only use your own styles. By default, docs object is empty and nothing happens. prismTheme would be the theme for code highlighting using PrismJS. We would need to find a way to conditionally fetch the right theme url and insert it in the story-component, could be done with User writes (without the \```js preview-story
<simba-checkbox-group>...</simba-checkbox-group>
\``` Resulting DOM for docs preview-story: <mdjs-preview-story>
#shadow-root
<link rel="stylesheet" href="https://gitcdn.link/repo/PrismJS/prism-themes/master/themes/prism-vsc-dark-plus.css">
<style>/* if enabled, BKL provided styles */</style>
<style>/* if passed, user provided styles */</style>
<div class="story__container">
<simba-checkbox-group>...</simba-checkbox-group>
</div>
<details>
<summary>
::marker
Code
</summary>
<pre class="language-js">
<code class="language-js">
...
</code>
</pre>
</details>
</mdjs-preview-story> Implementation-wise, I don't know exactly what the feasibility is because I don't know the ins and outs of MDJS, how customizable it is, or what BKL's implementation of MDJS is like, but this would be an API that I would personally be quite happy with as a design system creator. |
Beta Was this translation helpful? Give feedback.
-
We need to improve the default styles for our documentation to prevent the need to create own styles or the need to create them fully from scratch by giving good defaults and customisation options.
Use-cases
h1-h6
,p
...)Current solutions
For JSX we have a
dockit-react
package with<Playground>
and<ShadowPlayground>
<Playground>
live demo relies on global styles<Playground>
and then using it for each code block explicitly<ShadowPlayground>
introduces a Shadow DOM boundary and API to style live demo using a stylesheet passed as a property<ShadowPlayground>
and then using it for each code block explicitlyMDJS live demo and live editor is a set of normal HTML tags
import './styles.css';
Typography tags
import './styles.css';
MDXProvider
and pass a different set of typography tag implementations... not 100% sure what we have for Vue, Angular, Svelte, but I assume they have similar solutions
Improvement points
Proposal outline
<TailwindShowcases>
)<TailwindShowcases>
<details>
,<summary>
etc...)Beta Was this translation helpful? Give feedback.
All reactions