-
Notifications
You must be signed in to change notification settings - Fork 1
/
508-3c35062196dc20048f1e.js
1 lines (1 loc) · 7.64 KB
/
508-3c35062196dc20048f1e.js
1
(self.webpackChunkzent_docs=self.webpackChunkzent_docs||[]).push([[508],{60508:(n,t,e)=>{"use strict";e.r(t),e.d(t,{default:()=>h});var a=e(73450),s=e(27378),o=e(57318),p=e(24246);function r(n,t){var e=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),e.push.apply(e,a)}return e}function c(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?r(Object(e),!0).forEach((function(t){(0,a.Z)(n,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):r(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))}))}return n}function i(n){return(0,p.jsx)(n.tag,c(c({},n.attributes),{},{dangerouslySetInnerHTML:{__html:n.html}}))}function l(n){return(0,p.jsx)(i,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function d(n){return(0,p.jsx)(i,{tag:"style",html:n.style})}function u(n,t){for(;n;)return n.offsetTop&&"static"!==getComputedStyle(n).position&&(t+=n.offsetTop),u(n.parentNode,t);return t}class h extends s.Component{componentDidMount(){var n=location.hash;if(n){var t=document.querySelector('a[href="'.concat(n,'"]'));t&&(0,o.l)(document.documentElement,0,u(t,-9))}}render(){return s.createElement("div",{className:"zandoc-react-container"},s.createElement(d,{style:""}),s.createElement(l,{html:'<h2 class="anchor-heading"><a href="#writing-documentation">¶</a><a href="javascript:void(0)" id="writing-documentation" class="anchor-point"></a>Writing Documentation</h2>\n<h4 class="anchor-heading"><a href="#file-format">¶</a><a href="javascript:void(0)" id="file-format" class="anchor-point"></a>File Format</h4>\n<p>It\'s Markdown.</p>\n<p>But in order to support demos and internationalization, there\'re some things you need to know.</p>\n<p>Keep reading.</p>\n<h4 class="anchor-heading"><a href="#title">¶</a><a href="javascript:void(0)" id="title" class="anchor-point"></a>Title</h4>\n<p>Titles begin from <code>h2</code>(e.g. <code>##</code> in Markdown), <code>h3</code> and <code>h4</code> is enough in most cases.</p>\n<p>Don\'t nesting too many levels.</p>\n<h4 class="anchor-heading"><a href="#description">¶</a><a href="javascript:void(0)" id="description" class="anchor-point"></a>Description</h4>\n<p>You can put a component description below the first title. Be concise.</p>\n<h4 class="anchor-heading"><a href="#guides-optional">¶</a><a href="javascript:void(0)" id="guides-optional" class="anchor-point"></a>Guides (Optional)</h4>\n<p>You can have a usage guide following the description, starts with an <code>h3</code>.</p>\n<h4 class="anchor-heading"><a href="#demos">¶</a><a href="javascript:void(0)" id="demos" class="anchor-point"></a>Demos</h4>\n<p>Demos are written in separate files in <code>demos</code> sub-directory.</p>\n<p>Demos are automatically inserted into the final documentation by our loader.</p>\n<pre><code class="language-text"><span class="token operator">--</span><span class="token operator">-</span>\n<span class="token literal-property property">order</span><span class="token operator">:</span> <span class="token number">1</span> <span class="token comment">// `order` defines the order in the final documentation, smaller first</span>\nzh<span class="token operator">-</span><span class="token constant">CN</span><span class="token operator">:</span> <span class="token comment">// Start of Chinese string definitions</span>\n <span class="token literal-property property">title</span><span class="token operator">:</span> 基础用法 <span class="token comment">// Required, demo title</span>\n <span class="token literal-property property">content</span><span class="token operator">:</span> 公告内容 <span class="token comment">// `content` will be replace as `公告内容` in Chinese documentaion</span>\nen<span class="token operator">-</span><span class="token constant">US</span><span class="token operator">:</span> <span class="token comment">// Start of English string definitions</span>\n <span class="token literal-property property">title</span><span class="token operator">:</span> <span class="token maybe-class-name">Basic</span> <span class="token comment">// Required, demo title</span>\n <span class="token literal-property property">content</span><span class="token operator">:</span> <span class="token maybe-class-name">Alert</span> content <span class="token comment">// `content` will be replace as `Alert content` in English documentaion</span>\n<span class="token operator">--</span><span class="token operator">-</span>\n\n<span class="token template-string"><span class="token template-punctuation string">`</span><span class="token template-punctuation string">`</span></span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">jsx\nimport { Alert } from \'zent\';\nReactDOM.render( // ReactDOM.render is the entry point\n <Alert>{i18n.content}</Alert> // The component you want to render\n , mountNode // </span><span class="token template-punctuation string">`</span></span>mountNode<span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string"> is predefined\n);\n</span><span class="token template-punctuation string">`</span></span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token template-punctuation string">`</span></span>\n\n<span class="token comment">// It\'s precss</span>\n<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>style</span><span class="token punctuation">></span></span>\n <span class="token punctuation">.</span><span class="token property-access">zent</span><span class="token operator">-</span>badge <span class="token punctuation">{</span>\n <span class="token punctuation">.</span><span class="token property-access">nested</span> <span class="token punctuation">{</span>\n <span class="token literal-property property">background</span><span class="token operator">:</span> red<span class="token punctuation">;</span>\n <span class="token punctuation">}</span>\n <span class="token punctuation">}</span>\n<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>style</span><span class="token punctuation">></span></span></code></pre>\n<p>A demo can have three parts:</p>\n<ul>\n<li>\n<p>YAML configuration</p>\n<ul>\n<li><code>order</code> and <code>title</code> are required</li>\n</ul>\n</li>\n<li>\n<p>JavaScript code</p>\n<ul>\n<li>Use <code>i18n.varName</code> as a placeholder to texts, and define <code>varName</code> in YAML.</li>\n</ul>\n</li>\n<li>\n<p>styles(optional)</p>\n<ul>\n<li>You don\'t need this in most cases</li>\n</ul>\n</li>\n</ul>\n<p>Some rules for writing demos:</p>\n<ul>\n<li>Start from the basics</li>\n<li>Orthogonal: one demo for one senario</li>\n</ul>\n<h4 class="anchor-heading"><a href="#api">¶</a><a href="javascript:void(0)" id="api" class="anchor-point"></a>API</h4>\n<p>Use a table for your APIs, the table should have these columns:</p>\n<table class="table">\n<thead>\n<tr>\n<th>Property</th>\n<th>Description</th>\n<th>Type</th>\n<th>Required</th>\n<th>Default</th>\n<th>Alternative</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>visible</td>\n<td>Show or hide</td>\n<td>bool</td>\n<td>No</td>\n<td><code>false</code></td>\n<td><code>true</code>\n \n|\n \n<code>false</code></td>\n</tr>\n</tbody>\n</table>'}))}}}}]);