site: remove useless code

This commit is contained in:
Benjy Cui 2016-04-05 14:27:49 +08:00
parent 202f01c292
commit fccc268fc0
9 changed files with 0 additions and 2347 deletions

View File

@ -1,31 +0,0 @@
'use strict';
const babel = require('babel-core');
const recast = require('recast');
const builders = recast.types.builders;
const babelrc = {
presets: ['es2015', 'react']
};
// const demo = 'import { Button } from \'antd\';' +
// 'ReactDOM.render(<div>' +
// ' <Button type="primary">主按钮</Button>' +
// ' <Button>次按钮</Button>' +
// ' <Button type="ghost">幽灵按钮</Button>' +
// '</div>,' +
// 'document.getElementById(\'components-button-demo-basic\'));';
// devil(demo);
module.exports = function devil(demo, params) {
const compiled = babel.transform(demo, babelrc).code;
const ast = recast.parse(compiled);
const astProgramBody = ast.program.body;
const lastIndex = astProgramBody.length - 1;
astProgramBody[lastIndex] = builders.returnStatement(
astProgramBody[lastIndex].expression.arguments[0]
);
const code = recast.print(ast).code;
return new Function((params || []).join(', '), code);
}

View File

@ -1,175 +0,0 @@
const React = require('react');
const ReactDOM = require('react-dom');
import { QueueAnim, Icon, Button } from '../index';
import ScrollOverPack from 'rc-scroll-anim/lib/ScrollOverPack';
import ScrollLink from 'rc-scroll-anim/lib/ScrollLink';
import ScrollElement from 'rc-scroll-anim/lib/ScrollElement';
import scrollScreen from 'rc-scroll-anim/lib/ScrollScreen';
import ScrollEvent from 'rc-scroll-anim/lib/EventDispatcher';
import mapped from 'rc-scroll-anim/lib/Mapped';
import TweenOne from 'rc-tween-one';
module.exports = function() {
InstantClickChangeFns.push(function() {
if (!document.getElementById('banner')) {
// componentWillUnmount 不会触发, 手动删掉事件;
ScrollEvent._listeners = {};
mapped.unMount();
return;
}
// 导航处理
function scrollNavEvent() {
const scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
const clientHeight = document.documentElement.clientHeight;
if (scrollTop >= clientHeight) {
header.className = header.className.indexOf('home-nav-bottom') >= 0 ? header.className : header.className + ' home-nav-bottom';
} else {
header.className = header.className.replace(/home-nav-bottom/ig, '');
}
}
$(window).off('scroll.scrollNavEvent');
$(window).on('scroll.scrollNavEvent', scrollNavEvent);
// list point
class Link extends React.Component {
componentDidMount() {
// 整屏滚动;
scrollScreen.init({docHeight: 4746});
}
render() {
return (
<div>
<ScrollLink className="list-point" location="banner"/>
<ScrollLink className="list-point" location="page1"/>
<ScrollLink className="list-point" location="page2"/>
<ScrollLink className="list-point" location="page3"/>
<ScrollLink className="list-point" location="page4"/>
</div>
);
}
}
ReactDOM.render(<Link />, document.getElementById('list'));
// banner
class Banner extends React.Component {
constructor() {
super(...arguments);
}
typeFunc(a) {
if (a.key === 'line') {
return 'right';
} else if (a.key === 'button') {
return 'bottom';
}
return 'left';
}
render() {
return (
<ScrollElement scrollName="banner" style={{height: '100%'}}>
<QueueAnim className="banner-text-wrapper" type={this.typeFunc} delay={300}>
<h2 key="h2">ANT <p>DESIGN</p></h2>
<p key="content">一个 UI 设计语言</p>
<span className="line" key="line"/>
<div className="start-button" key="button">
<a href="/docs/spec/introduce"><Icon type="smile-circle"/>开始探索</a>
</div>
<iframe key="github-btn" src="https://ghbtns.com/github-btn.html?user=ant-design&repo=ant-design&type=star&count=true" frameBorder="0" scrolling="0" width="98px" height="20px" />
</QueueAnim>
<TweenOne className='down' vars={[{opacity: 1},{y: 10, duration: 800, yoyo: true, repeat: -1}]}>
<Icon type="down"/>
</TweenOne>
</ScrollElement>
)
}
}
ReactDOM.render(<Banner />, document.getElementById('banner'));
// page1
class Page1 extends React.Component {
render() {
return (
<ScrollOverPack scrollName="page1" className="content-wrapper" playScale={1} replay>
<TweenOne key="image" className="image1 image-wrapper" vars={{x: 0, opacity: 1, duration: 550}}
style={{transform: 'translateX(-100px)', opacity: 0}} hideProps={{type: 'reverse'}}/>
<QueueAnim className="text-wrapper" delay={300} key="text" duration={550} leaveReverse
hideProps={{child: null}}>
<h2 key="h2">最佳实践</h2>
<p key="p" style={{maxWidth: 310}}>近一年的中台设计实践积累了大量的优秀案例</p>
<div key="button"><Button type="primary" size="large"
onClick={()=>{window.location.href='/docs/practice/cases'}}>了解更多<Icon
type="right"/></Button></div>
</QueueAnim>
</ScrollOverPack>
);
}
}
ReactDOM.render(<Page1 />, document.getElementById('page1'));
//page2
class Page2 extends React.Component {
render() {
return (
<ScrollOverPack scrollName="page2" className="content-wrapper" playScale={1} replay>
<QueueAnim className="text-wrapper left-text" delay={300} key="text" duration={550} type='bottom'
leaveReverse
hideProps={{child: null}}>
<h2 key="h2">设计模式</h2>
<p key="p" style={{maxWidth: 260}}>总结中台设计中反复出现的问题并提供相应的解决方案</p>
<div key="button"><Button type="primary" size="large"
onClick={()=>{window.location.href='/docs/pattern/navigation'}}>了解更多<Icon
type="right"/></Button>
</div>
</QueueAnim>
<TweenOne key="image" className="image2 image-wrapper" vars={{x: 0, opacity: 1, delay: 300, duration: 550}}
style={{transform: 'translateX(100px)', opacity: 0}} hideProps={{type: 'reverse'}}/>
</ScrollOverPack>
);
}
}
ReactDOM.render(<Page2 />, document.getElementById('page2'));
// page3
class Page3 extends React.Component {
render() {
return (
<ScrollOverPack scrollName="page3" className="content-wrapper" playScale={1} replay>
<TweenOne key="image" className="image3 image-wrapper" vars={{x: 0, opacity: 1, duration: 550}}
style={{transform: 'translateX(-100px)', opacity: 0}} hideProps={{type: 'reverse'}}/>
<QueueAnim className="text-wrapper" delay={300} key="text" duration={550} leaveReverse style={{top: '40%'}}
hideProps={{child: null}}>
<h2 key="h2">丰富的基础组件</h2>
<p key="p" style={{maxWidth: 280}}>丰富灵活实用的基础组件为业务产品提供强有力的设计支持</p>
<div key="button"><Button type="primary" size="large"
onClick={()=>{window.location.href='/docs/react/introduce'}}>了解更多<Icon
type="right"/></Button></div>
</QueueAnim>
</ScrollOverPack>
);
}
}
ReactDOM.render(<Page3/>, document.getElementById('page3'));
// page4
class Page4 extends React.Component {
render(){
return (
<ScrollOverPack scrollName="page4" className="content-wrapper" playScale={1}>
<QueueAnim className="text-wrapper-bottom" delay={300} key="text" duration={550} leaveReverse type="bottom"
hideProps={{child: null}}>
<h2 key="h2">微小·确定·幸福</h2>
<p key="p">这是一个致力于提升用户设计者使用体验的中台设计语言</p>
</QueueAnim>
<TweenOne key="image" className="image4 bottom-wrapper" vars={{y: 0, opacity: 1, duration: 550, delay: 550}}
style={{transform: 'translateY(50px)', opacity: 0}} hideProps={{type: 'reverse'}}/>
</ScrollOverPack>
);
}
}
ReactDOM.render(<Page4 />, document.getElementById('page4'));
});
};

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +0,0 @@
<div class="code-box" id="{{post.meta.id|removeCodeBoxIdPrefix}}">
<div class="code-box-demo">
<div id="{{post.meta.id}}"></div>
<script>mountNode = document.getElementById('{{post.meta.id}}');</script>
{{ post.html }}
</div>
<div class="code-box-meta markdown">
<div class="code-box-title">
<a href="#{{post.meta.id|removeCodeBoxIdPrefix}}">{{ post.title }}</a>
</div>
{{ post.meta.description }}
<span class="collapse anticon anticon-circle-o-right" unselectable="none"></span>
</div>
</div>

View File

@ -1,20 +0,0 @@
{% extends "page.html" %}
{% block content %}
<section class="main-container">
<article class="markdown">
<h1>
{{ post.title }} {{ post.meta.chinese }}{{ post.meta.subtitle }}
{%- if post.meta.API %}
<a class="api-link" href="http://{{ post.meta.API }}" target="_blank">
<i class="anticon anticon-link"></i>
API 使用说明
</a>
{%- endif %}
</h1>
{{ post.html|add_anchor }}
</article>
{%- include "demos.html" %}
<div class="api-container markdown"></div>
</section>
{% endblock %}

View File

@ -1,40 +0,0 @@
{%- set items = resource.pages|find_demo_in_component(post.meta.directory) %}
{%- if items.length > 0 %}
<h2 class="component-demos">
代码演示
<i class="anticon anticon-appstore icon-all" title="展开全部代码"></i>
</h2>
<div class="code-boxes">
{%- if post.meta.cols == 1 %}
<div class="code-boxes-col-1-1">
{%- for item in items %}
{%- set post = item.meta.filepath|parsePost %}
{%- include "code.html" %}
{%- endfor %}
</div>
{%- else %}
<div class="code-boxes-col-2-1">
{%- for item in items|odd %}
{%- set post = item.meta.filepath|parsePost %}
{%- include "code.html" %}
{%- endfor %}
</div>
<div class="code-boxes-col-2-1">
{%- for item in items|even %}
{%- set post = item.meta.filepath|parsePost %}
{%- include "code.html" %}
{%- endfor %}
</div>
{%- endif %}
</div>
<ul class="toc demos-anchor">
{%- for item in items %}
{%- set post = item.meta.filepath|parsePost %}
<li>
<a title="{{ post.title }}" href="#{{post.meta.id|removeCodeBoxIdPrefix}}">
<span>{{ post.title }}</span>
</a>
</li>
{%- endfor %}
</ul>
{%- endif %}

View File

@ -1,301 +0,0 @@
{% extends "layout.html" %}
{% block bodyAttribute %}class="index-page"{% endblock %}
{% block content %}
<link href="http://fonts.useso.com/css?family=Raleway:600,500,400,300" rel="stylesheet" type="text/css">
<div id="list"></div>
<section id="banner"></section>
<section id="page1" class="page"></section>
<section id="page2" class="page"></section>
<section id="page3" class="page"></section>
<section id="page4" class="page"></section>
<style>
.main-wrapper {
background: transparent;
width: auto;
margin: 0;
border-radius: 0;
padding: 0;
overflow: unset;
display: inline;
min-height: 600px;
}
#home-page,
#home-page > div {
height: 100%;
}
header {
position: fixed;
z-index: 999;
background: rgba(0, 0, 0, 0.25);
border-bottom: 1px solid transparent;
transition: border .5s cubic-bezier(0.455, 0.03, 0.515, 0.955), background .5s cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
header .nav ul li a {
color: #eee;
}
@media only screen and (min-width: 320px) and (max-width: 767px) {
header .nav ul li a {
color: #666;
}
}
.nav-phone-icon:before {
background: #eee;
box-shadow: 0 7px 0 0 #eee, 0 14px 0 0 #eee;
}
.nav ul li a {
transition: color 0.5s cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
.search {
border-left-color: rgba(235, 237, 238, .5);
transition: border 0.5s cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
.search #autoComplete .ant-select-selection {
background: transparent;
}
#banner {
position: relative;
height: 100%;
width: 100%;
background: url("https://os.alipayobjects.com/rmsportal/GhjqstwSgxBXrZS.png") no-repeat center / cover;
}
.banner-text-wrapper {
position: absolute;
left: 10%;
top: 55%;
color: #fff;
text-align: right;
}
header.home-nav-bottom {
background: rgba(255, 255, 255, 0.9);
border-bottom-color: #EBEDEE;
}
.home-nav-bottom .search {
border-left-color: #EBEDEE;
}
.home-nav-bottom .nav a {
color: #666;
}
.banner-text-wrapper h2 {
font-size: 40px;
font-weight: normal;
font-family: 'Raleway';
}
.banner-text-wrapper h2 p {
color: #FF3171;
display: inline-block;
}
.banner-text-wrapper .line {
width: 0.8px;
height: 76px;
position: absolute;
background: rgba(255, 255, 255, .44);
background-image: -webkit-linear-gradient(top, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.03));
background-image: -moz-linear-gradient(top, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.03));
background-image: -ms-linear-gradient(top, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.03));
background-image: -o-linear-gradient(top, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.03));
top: 16px;
right: -25px;
}
.banner-text-wrapper > p {
margin: 10px auto 24px;
font-size: 16px;
}
.banner-text-wrapper .start-button {
margin-bottom: 24px;
}
.banner-text-wrapper .start-button a {
width: 155px;
height: 45px;
border-radius: 6px;
border: 1px solid #2db7f5;
color: #2db7f5;
font-size: 18px;
background: transparent;
transition: box-shadow .45s ease-out;
text-align: center;
line-height: 42px;
display: inline-block;
}
.banner-text-wrapper iframe {
border: 0;
opacity: 0.8;
transition: opacity 0.3s ease;
}
.banner-text-wrapper iframe:hover {
opacity: 1;
}
.banner-text-wrapper a:hover {
box-shadow: 0 0 10px #2db7f5;
}
.banner-text-wrapper a span {
margin-left: 15px;
}
.down {
text-align: center;
position: absolute;
bottom: 30px;
color: rgba(255, 255, 255, .75);
left: 50%;
margin-left: -7px;
}
section {
height: 100%;
width: 100%;
background: #fff;
}
.page {
min-height: 700px;
}
.content-wrapper {
width: 100%;
height: 100%;
max-width: 1850px;
margin: auto;
overflow: hidden;
}
.content-wrapper .image-wrapper {
width: 65%;
float: left;
position: relative;
}
.image1 {
background: url("https://t.alipayobjects.com/images/T1Ch8kXfpdXXXXXXXX.png") no-repeat right / 841px;
height: 511px;
top: 50%;
margin-top: -256px;
}
.image2 {
background: url("https://t.alipayobjects.com/images/T1r5RkXotXXXXXXXXX.png") no-repeat left / 800px;
height: 474px;
top: 50%;
margin-top: -266px;
}
.image3 {
padding-right: 10%;
background: url("https://t.alipayobjects.com/images/T1nx0kXdFfXXXXXXXX.png") no-repeat right / 639px;
background-origin: content-box;
height: 500px;
top: 50%;
margin-top: -250px;
}
.image4 {
background: url("https://t.alipayobjects.com/images/T1lyJkXg4aXXXXXXXX.png") no-repeat center / 615px;
height: 364px;
margin: auto;
}
.content-wrapper .text-wrapper {
width: 35%;
float: left;
position: relative;
top: 20%;
left: 10px;
}
.content-wrapper .text-wrapper h2,
.content-wrapper .text-wrapper-bottom h2 {
font-size: 32px;
color: #666;
font-weight: normal;
}
.content-wrapper .text-wrapper p {
margin: 10px 0 20px;
font-size: 16px;
line-height: 28px;
color: #999999;
}
.content-wrapper .left-text {
padding-left: 10%;
}
.text-wrapper-bottom {
text-align: center;
margin: 10% auto 40px;
}
.text-wrapper-bottom p {
margin: 20px auto;
font-size: 16px;
line-height: 28px;
color: #999;
}
#footer {
background: #000;
}
.anticon-right {
transform: scale(0.6);
}
footer,
footer ul li > h2 {
color: #999;
}
footer ul li > a {
color: #eee;
}
#list {
position: fixed;
z-index: 9998;
top: 50%;
right: 20px;
width: 6px;
margin-top: -35px;
}
.list-point {
width: 6px;
height: 6px;
background: #00AAEE;
border-radius: 6px;
float: left;
margin: 4px auto;
opacity: 0.5;
cursor: pointer;
transition: opacity .3s;
}
.list-point:hover, .list-point.active {
opacity: 1;
}
</style>
{% endblock %}

View File

@ -1,110 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="description" content="{{ config.site.description }}"/>
<title>{% block title %}{{ config.site.name }} - {{ config.site.description }}{% endblock %}</title>
<link rel="icon" href="https://t.alipayobjects.com/images/T1QUBfXo4fXXXXXXXX.png" type="image/x-icon">
<link rel="shortcut icon" href="https://t.alipayobjects.com/images/T1QUBfXo4fXXXXXXXX.png" type="image/x-icon">
{% block styles %}{% endblock %}
<link rel="stylesheet" href="{{static_url('../dist/demo.css')}}">
<script src="https://as.alipayobjects.com/g/component/??console-polyfill/0.2.2/index.js,es5-shim/4.5.7/es5-shim.min.js,es5-shim/4.5.7/es5-sham.min.js,html5shiv/3.7.2/html5shiv.min.js,media-match/2.0.2/media.match.min.js,jquery/1.11.3/jquery.min.js,bluebird/3.1.1/bluebird.min.js"></script>
<script>
(function() {
window.ANT_COMPONENTS = [];
window.InstantClickChangeFns = [];
{%- for item in resource.pages|find_category(["CSS","Components"]) %}
ANT_COMPONENTS.push({
title: '{{item.title}}',
desc: '{{item.meta.chinese}}'
});
{%- endfor %}
// fix ie location origin
// http://stackoverflow.com/questions/22564167/window-location-origin-gives-wrong-value-when-using-ie
if (!window.location.origin) {
window.location.origin = window.location.protocol + "//"
+ window.location.hostname
+ (window.location.port ? ':' + window.location.port : '');
}
var i = location.pathname.split('/').lastIndexOf('ant-design');
if (i > 0) {
window.rootUrl = location.origin + location.pathname.split('/').slice(0, 2+1).join('/');
} else {
window.rootUrl = location.origin;
}
})();
</script>
<script>
window.antdVersion = {
latest: '{{config.package.version}}'
};
</script>
<script src="{{static_url('../dist/demo.js')}}"></script>
{% block scripts %}{% endblock %}
</head>
<body {% block bodyAttribute %}{% endblock %}>
<header id="header" class="clearfix">
<a class="logo" href="{{static_url('../')}}">
<img width="60" src="https://t.alipayobjects.com/images/rmsweb/T1B9hfXcdvXXXXXXXX.svg">
{{ config.site.name }}
</a>
<div class="search">
<div id="autoComplete"></div>
</div>
<nav class="nav" tabindex="-1">
<span class="bar"></span>
<ul>
<li class="{%- if post.meta.filepath === 'README.md' %}current{%- endif %}">
<a href="{{static_url('../')}}">首页</a>
</li>
<li class="{%- if post.directory|rootDirectoryIn(['docs/practice']) %}current{%- endif %}">
<a href="{{static_url('../docs/practice/cases')}}">实践</a>
</li>
<li class="{%- if post.directory|rootDirectoryIn(['docs/pattern']) %}current{%- endif %}">
<a href="{{static_url('../docs/pattern/navigation')}}">模式</a>
</li>
<li class="{%- if post.directory|rootDirectoryIn(['docs/react','components']) or post.meta.filepath === 'CHANGELOG.md' %}current{%- endif %}">
<a href="{{static_url('../docs/react/introduce')}}">组件</a>
</li>
<li class="{%- if post.directory|rootDirectoryIn(['docs/spec']) %}current{%- endif %}">
<a href="{{static_url('../docs/spec/introduce')}}">语言</a>
</li>
<li class="{%- if post.directory|rootDirectoryIn(['docs/resource']) %}current{%- endif %}">
<a href="{{static_url('../docs/resource/download')}}">资源</a>
</li>
</ul>
</nav>
<div class="nav-phone-icon"></div>
</header>
<div class="main-wrapper">
{% block aside %}{% endblock %} {% block content %}{% endblock %}
</div>
{%- include "footer.html" %}
<script data-no-instant>
if (!location.port) {
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-72788897-1', 'auto');
ga('send', 'pageview');
InstantClick.on('change', function() {
ga('send', 'pageview', location.pathname + location.search);
});
}
</script>
<script data-no-instant>
InstantClick.on('change', function() {
InstantClickChangeFns.forEach(function(fn) {
fn();
});
});
InstantClick.init();
</script>
</body>
</html>

View File

@ -1,26 +0,0 @@
{% extends "layout.html" %}
{% block title %}
{%- if post.title !== config.site.name %}
{{post.title}} {{ post.meta.chinese }} - {{config.site.name}}
{%- else %}
{{ config.site.name }} - {{ config.site.description }}
{%- endif %}
{% endblock %}
{% block description %}{% if post.summay %}{{post.summary}}{% endif %}{% endblock %}
{% block aside %}
{%- include "aside.html" %}
{% endblock %}
{% block content %}
<section class="main-container">
<article class="markdown">
<h1>{{ post.title }} <span class="subtitle">{{ post.meta.subtitle }}</span></h1>
{{ post.meta.description }}
<div class="toc">{{ post.toc }}</div>
{{ post.html|add_anchor }}
</article>
</section>
{% endblock %}