-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path14-bc4eac5649ec72ccd951.js
1 lines (1 loc) · 6.5 KB
/
14-bc4eac5649ec72ccd951.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{678:function(n,t,e){"use strict";e.r(t),e.d(t,"default",function(){return S});var a=e(23),s=e.n(a),o=e(24),i=e.n(o),c=e(25),p=e.n(c),r=e(26),l=e.n(r),d=e(32),u=e.n(d),h=e(27),m=e.n(h),f=e(28),k=e.n(f),g=e(580),v=e.n(g),y=e(0),b=e.n(y),w=e(111);function A(n){return b.a.createElement(n.tag,v()({},n.attributes,{dangerouslySetInnerHTML:{__html:n.html}}))}function D(n){return b.a.createElement(A,{tag:"section",html:n.html,attributes:{className:"zandoc-react-markdown"}})}function C(n){return b.a.createElement(A,{tag:"style",html:n.style})}y.Component;var S=function(n){function t(){return s()(this,t),p()(this,l()(t).apply(this,arguments))}return m()(t,n),i()(t,[{key:"componentDidMount",value:function(){var n=location.hash;if(n){var t=document.querySelector('a[href="'.concat(n,'"]'));t&&Object(w.a)(document.documentElement,0,function n(t,e){for(;t;)return t.offsetTop&&"static"!==getComputedStyle(t).position&&(e+=t.offsetTop),n(t.parentNode,e);return e}(t,-9))}}},{key:"render",value:function(){return b.a.createElement("div",{className:"zandoc-react-container",key:null},b.a.createElement(C,{style:""}),b.a.createElement(D,{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>\norder<span class="token punctuation">:</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>CN<span class="token punctuation">:</span> <span class="token comment">// Start of Chinese string definitions</span>\n title<span class="token punctuation">:</span> 基础用法 <span class="token comment">// Required, demo title</span>\n content<span class="token punctuation">:</span> 公告内容 <span class="token comment">// `content` will be replace as `公告内容` in Chinese documentaion</span>\nen<span class="token operator">-</span>US<span class="token punctuation">:</span> <span class="token comment">// Start of English string definitions</span>\n title<span class="token punctuation">:</span> Basic <span class="token comment">// Required, demo title</span>\n content<span class="token punctuation">:</span> Alert 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 string">``</span></span><span class="token template-string"><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>mountNode<span class="token template-string"><span class="token string">` is predefined\n);\n`</span></span><span class="token template-string"><span class="token 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>zent<span class="token operator">-</span>badge <span class="token punctuation">{</span>\n <span class="token punctuation">.</span>nested <span class="token punctuation">{</span>\n background<span class="token punctuation">:</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>'}))}}]),t}(y.Component)}}]);