mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
grafana/ui: Enable mdx imports in stories (#19937)
This commit is contained in:
parent
80a6853fd4
commit
2a8762f6a3
@ -73,7 +73,7 @@ module.exports = ({ config, mode }) => {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
config.resolve.extensions.push('.ts', '.tsx');
|
config.resolve.extensions.push('.ts', '.tsx', '.mdx');
|
||||||
config.stats = {
|
config.stats = {
|
||||||
warningsFilter: /export .* was not found in/,
|
warningsFilter: /export .* was not found in/,
|
||||||
};
|
};
|
||||||
|
3
packages/grafana-ui/src/components/Switch/Switch.mdx
Normal file
3
packages/grafana-ui/src/components/Switch/Switch.mdx
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Switch
|
||||||
|
|
||||||
|
A basic docs for Switch component
|
@ -1,14 +1,16 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
// import { storiesOf } from '@storybook/react';
|
|
||||||
// import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
|
|
||||||
import { Switch } from './Switch';
|
import { Switch } from './Switch';
|
||||||
import { text } from '@storybook/addon-knobs';
|
import { text } from '@storybook/addon-knobs';
|
||||||
|
import mdx from './Switch.mdx';
|
||||||
|
|
||||||
const getStory = (title: string, component: any) => ({
|
const getStory = (title: string, component: any) => ({
|
||||||
title,
|
title,
|
||||||
parameters: {
|
parameters: {
|
||||||
component,
|
component,
|
||||||
|
docs: {
|
||||||
|
page: mdx,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
4
packages/grafana-ui/src/types/mdx.d.ts
vendored
Normal file
4
packages/grafana-ui/src/types/mdx.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
declare module '*.mdx' {
|
||||||
|
let MDXComponent: (props: any) => JSX.Element;
|
||||||
|
export default MDXComponent;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user