mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 21:19:37 +08:00
parent
b10f4cffd9
commit
551763e768
@ -232,12 +232,17 @@ Array [
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`renders ./components/tag/demo/colorful.md correctly 1`] = `
|
exports[`renders ./components/tag/demo/colorful.md correctly 1`] = `
|
||||||
<div>
|
Array [
|
||||||
<h4
|
<div
|
||||||
style="margin-bottom:16px"
|
class="ant-divider ant-divider-horizontal ant-divider-with-text ant-divider-with-text-left"
|
||||||
|
role="separator"
|
||||||
>
|
>
|
||||||
Presets:
|
<span
|
||||||
</h4>
|
class="ant-divider-inner-text"
|
||||||
|
>
|
||||||
|
Presets
|
||||||
|
</span>
|
||||||
|
</div>,
|
||||||
<div>
|
<div>
|
||||||
<span
|
<span
|
||||||
class="ant-tag ant-tag-magenta"
|
class="ant-tag ant-tag-magenta"
|
||||||
@ -294,12 +299,17 @@ exports[`renders ./components/tag/demo/colorful.md correctly 1`] = `
|
|||||||
>
|
>
|
||||||
purple
|
purple
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>,
|
||||||
<h4
|
<div
|
||||||
style="margin:16px 0"
|
class="ant-divider ant-divider-horizontal ant-divider-with-text ant-divider-with-text-left"
|
||||||
|
role="separator"
|
||||||
>
|
>
|
||||||
Custom:
|
<span
|
||||||
</h4>
|
class="ant-divider-inner-text"
|
||||||
|
>
|
||||||
|
Custom
|
||||||
|
</span>
|
||||||
|
</div>,
|
||||||
<div>
|
<div>
|
||||||
<span
|
<span
|
||||||
class="ant-tag ant-tag-has-color"
|
class="ant-tag ant-tag-has-color"
|
||||||
@ -325,8 +335,8 @@ exports[`renders ./components/tag/demo/colorful.md correctly 1`] = `
|
|||||||
>
|
>
|
||||||
#108ee9
|
#108ee9
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>,
|
||||||
</div>
|
]
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`renders ./components/tag/demo/control.md correctly 1`] = `
|
exports[`renders ./components/tag/demo/control.md correctly 1`] = `
|
||||||
|
@ -14,11 +14,11 @@ title:
|
|||||||
We preset a series of colorful tag styles for use in different situations. You can also set it to a hex color string for custom color.
|
We preset a series of colorful tag styles for use in different situations. You can also set it to a hex color string for custom color.
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
import { Tag } from 'antd';
|
import { Tag, Divider } from 'antd';
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<div>
|
<>
|
||||||
<h4 style={{ marginBottom: 16 }}>Presets:</h4>
|
<Divider orientation="left">Presets</Divider>
|
||||||
<div>
|
<div>
|
||||||
<Tag color="magenta">magenta</Tag>
|
<Tag color="magenta">magenta</Tag>
|
||||||
<Tag color="red">red</Tag>
|
<Tag color="red">red</Tag>
|
||||||
@ -32,14 +32,14 @@ ReactDOM.render(
|
|||||||
<Tag color="geekblue">geekblue</Tag>
|
<Tag color="geekblue">geekblue</Tag>
|
||||||
<Tag color="purple">purple</Tag>
|
<Tag color="purple">purple</Tag>
|
||||||
</div>
|
</div>
|
||||||
<h4 style={{ margin: '16px 0' }}>Custom:</h4>
|
<Divider orientation="left">Custom</Divider>
|
||||||
<div>
|
<div>
|
||||||
<Tag color="#f50">#f50</Tag>
|
<Tag color="#f50">#f50</Tag>
|
||||||
<Tag color="#2db7f5">#2db7f5</Tag>
|
<Tag color="#2db7f5">#2db7f5</Tag>
|
||||||
<Tag color="#87d068">#87d068</Tag>
|
<Tag color="#87d068">#87d068</Tag>
|
||||||
<Tag color="#108ee9">#108ee9</Tag>
|
<Tag color="#108ee9">#108ee9</Tag>
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</>,
|
||||||
mountNode,
|
mountNode,
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
@ -181,10 +181,7 @@ class Demo extends React.Component {
|
|||||||
html,
|
html,
|
||||||
js: sourceCode
|
js: sourceCode
|
||||||
.replace(/import\s+{(\s+[^}]*\s+)}\s+from\s+'antd';/, 'const { $1 } = antd;')
|
.replace(/import\s+{(\s+[^}]*\s+)}\s+from\s+'antd';/, 'const { $1 } = antd;')
|
||||||
.replace(
|
.replace(/import\s+{(\s+[^}]*\s+)}\s+from\s+'@ant-design\/icons';/, 'const { $1 } = icons;')
|
||||||
/import\s+{(\s+[^}]*\s+)}\s+from\s+'@ant-design\/icons';/,
|
|
||||||
'const { $1 } = icons;',
|
|
||||||
)
|
|
||||||
.replace("import moment from 'moment';", '')
|
.replace("import moment from 'moment';", '')
|
||||||
.replace(/import\s+{\s+(.*)\s+}\s+from\s+'react-router';/, 'const { $1 } = ReactRouter;')
|
.replace(/import\s+{\s+(.*)\s+}\s+from\s+'react-router';/, 'const { $1 } = ReactRouter;')
|
||||||
.replace(
|
.replace(
|
||||||
@ -252,7 +249,11 @@ import 'antd/dist/antd.css';
|
|||||||
import './index.css';
|
import './index.css';
|
||||||
${parsedSourceCode.replace('mountNode', "document.getElementById('container')")}
|
${parsedSourceCode.replace('mountNode', "document.getElementById('container')")}
|
||||||
`.trim();
|
`.trim();
|
||||||
const indexCssContent = (style || '').replace(new RegExp(`#${meta.id}\\s*`, 'g'), '');
|
const indexCssContent = (style || '')
|
||||||
|
.trim()
|
||||||
|
.replace(new RegExp(`#${meta.id}\\s*`, 'g'), '')
|
||||||
|
.replace('</style>', '')
|
||||||
|
.replace('<style>', '');
|
||||||
|
|
||||||
const codesandboxPackage = {
|
const codesandboxPackage = {
|
||||||
name: `${localizedTitle} - Ant Design Demo`,
|
name: `${localizedTitle} - Ant Design Demo`,
|
||||||
@ -299,9 +300,7 @@ ${parsedSourceCode.replace('mountNode', "document.getElementById('container')")}
|
|||||||
<section className={codeBoxClass} id={meta.id}>
|
<section className={codeBoxClass} id={meta.id}>
|
||||||
<section className="code-box-demo">
|
<section className="code-box-demo">
|
||||||
<ErrorBoundary>{this.liveDemo}</ErrorBoundary>
|
<ErrorBoundary>{this.liveDemo}</ErrorBoundary>
|
||||||
{style ? (
|
{style ? <style dangerouslySetInnerHTML={{ __html: style }} /> : null}
|
||||||
<style dangerouslySetInnerHTML={{ __html: style }} />
|
|
||||||
) : null}
|
|
||||||
</section>
|
</section>
|
||||||
<section className="code-box-meta markdown">
|
<section className="code-box-meta markdown">
|
||||||
<div className="code-box-title">
|
<div className="code-box-title">
|
||||||
|
Loading…
Reference in New Issue
Block a user