From 41460d615a3a7f5ac077d5fb72b2119e86f537ac Mon Sep 17 00:00:00 2001 From: Benjy Cui Date: Fri, 25 Mar 2016 17:07:00 +0800 Subject: [PATCH] site: add demo preview animation --- site/common/styles/demo.less | 20 +++++++++++++++- site/component/Demo/index.jsx | 44 +++++++++++++++-------------------- 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/site/common/styles/demo.less b/site/common/styles/demo.less index 4838d3116c..1de7096118 100644 --- a/site/common/styles/demo.less +++ b/site/common/styles/demo.less @@ -120,6 +120,10 @@ word-break: break-word; } +.code-box.expand .code-box-meta { + border-bottom: 1px dashed #e9e9e9; +} + .code-box .collapse { position: absolute; right: 16px; @@ -148,10 +152,24 @@ opacity: 1; } +.code-box .highlight-wrapper { + max-height: 0; + opacity: 0; + overflow: auto; + transition: all 0.4s ease; +} +.code-box .highlight-wrapper-expand { + max-height: 500px; + opacity: 1; +} + .code-box .highlight { overflow: hidden; padding: 5px; - border-top: 1px dashed #e9e9e9; + + &:not(:first-child) { + border-top: 1px dashed #e9e9e9; + } } .code-box pre { diff --git a/site/component/Demo/index.jsx b/site/component/Demo/index.jsx index df62c09070..eca9d4c1a8 100644 --- a/site/component/Demo/index.jsx +++ b/site/component/Demo/index.jsx @@ -1,7 +1,6 @@ import React from 'react'; import { Link } from 'react-router'; import classNames from 'classnames'; -import Animate from 'rc-animate'; import * as utils from '../utils'; export default class Demo extends React.Component { @@ -61,32 +60,27 @@ export default class Demo extends React.Component { onClick={this.handleCodeExapnd.bind(this)} unselectable="none" /> - +
+
+
+              
+            
+
{ - codeExpand ? -
-
-
-                    
-                  
-
- { - style ? -
-
-                        
-                      
-
: - null - } -
:
+ style ? +
+
+                  
+                
+
: + null } - +
); } -- GitLab