cleanup
This commit is contained in:
parent
14732007b6
commit
6c38ba29e8
5 changed files with 7 additions and 53 deletions
|
|
@ -108,7 +108,7 @@
|
|||
{/if}
|
||||
{#if typeof hed === 'string'}
|
||||
<h1 class={hedClass}>
|
||||
<Markdown source={hed} parseInline />
|
||||
<Markdown source={hed} inline />
|
||||
</h1>
|
||||
{:else if hed}
|
||||
<!-- Headline snippet -->
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
</div>
|
||||
{:else}
|
||||
<div class="body">
|
||||
<Markdown source={text} />
|
||||
<Markdown source={text || ''} />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
|
|
|||
3
src/docs/utils/css-to-js/index.d.ts
vendored
3
src/docs/utils/css-to-js/index.d.ts
vendored
|
|
@ -1 +1,2 @@
|
|||
export function convert(input: any, ...args: any[]): any;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export function convert(input: any, ...args: any[]): Record<string, string>;
|
||||
|
|
|
|||
|
|
@ -16,9 +16,8 @@ export const cssStringToTableArray = (cssString = '', withInclude = false) => {
|
|||
)};`;
|
||||
})
|
||||
.join('\n');
|
||||
return withInclude ?
|
||||
[className, className, properties]
|
||||
: [className, properties];
|
||||
if (withInclude) return [className, className, properties];
|
||||
return [className, properties];
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -35,7 +34,7 @@ export const extractCssColourVariables = (cssString = '') => {
|
|||
const cssVariables = [...cssString.matchAll(variableRegexp)].map(
|
||||
([_, g1, g2]) => [g2, g1]
|
||||
);
|
||||
const colours = {};
|
||||
const colours: Record<string, string[]> = {};
|
||||
for (const variable of cssVariables) {
|
||||
const [colour, css] = variable;
|
||||
if (colours[colour]) {
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/**
|
||||
* Use custom source code in the "Show code" pull down.
|
||||
* @param {object} source Source code object, where key is the language of the source code and value is the code string.
|
||||
* @param {object} otherOptions Other props object options, allowing chaining with other methods like withStoryDocs
|
||||
* @returns props object including parameters
|
||||
*/
|
||||
export const withSource = (source, otherOptions = {}) => {
|
||||
const language = Object.keys(source)[0];
|
||||
const code = source[language];
|
||||
const docs = {
|
||||
...otherOptions?.parameters?.docs,
|
||||
source: { code, language },
|
||||
};
|
||||
const parameters = { docs };
|
||||
return { parameters };
|
||||
};
|
||||
|
||||
/**
|
||||
* Add custom documentation to a story.
|
||||
* @param {string} storyDocs Markdown string of docs
|
||||
* @param {object} otherOptions Other props object options, allowing chaining with other methods like withSource
|
||||
* @returns props object including parameters
|
||||
*/
|
||||
export const withStoryDocs = (storyDocs, otherOptions = {}) => {
|
||||
const docs = {
|
||||
...otherOptions?.parameters?.docs,
|
||||
description: { story: storyDocs },
|
||||
};
|
||||
const parameters = { docs };
|
||||
return { parameters };
|
||||
};
|
||||
|
||||
/**
|
||||
* Add custom documentation to the top of the component docs page.
|
||||
* @param {string} componentDocs Markdown string of docs
|
||||
* @param {object} otherOptions Other props object options, allowing chaining with other methods like withSource
|
||||
* @returns props object including parameters
|
||||
*/
|
||||
export const withComponentDocs = (componentDocs, otherOptions = {}) => {
|
||||
const docs = {
|
||||
...otherOptions?.parameters?.docs,
|
||||
description: { component: componentDocs },
|
||||
};
|
||||
const parameters = { docs };
|
||||
return { parameters };
|
||||
};
|
||||
Loading…
Reference in a new issue