88 < h1 > Basic Example</ h1 >
99 < div id ="container "> </ div >
1010 < script src ="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.js "> </ script >
11- < script src ="https://cdnjs.cloudflare. com/ajax/libs/ babel-core/5.8.24/browser .min.js "> </ script >
11+ < script src ="https://unpkg. com/babel-standalone@6.26.0/babel .min.js "> </ script >
1212 < script src ="/vue-styled-components.js "> </ script >
1313 < script type ="text/babel ">
1414
@@ -32,19 +32,45 @@ <h1>Basic Example</h1>
3232 // Create a <CustomTitle> vue component that renders an <h1> which is
3333 // centered, palevioletred and sized at 1.5em
3434 const CustomTitle = styled . default . h1 `
35- font-size: 1.5em ;
35+ font-size: 2em ;
3636 text-align: center;
3737 color: ${ props => props . theme . primary } ;
3838 animation: ${ animation } 2s linear infinite;
39+
40+ @supports (-webkit-text-stroke: 1px) {
41+ -webkit-text-stroke: 2px ${ props => props . theme . primary } ;
42+ color: transparent
43+ }
3944 ` ;
4045
46+ const H2 = CustomTitle . withComponent ( 'h2' )
47+
4148 // Create a <Wrapper> vue component that renders a <section> with
4249 // some padding and a papayawhip background
4350 const Wrapper = styled . default . section `
4451 padding: 4em;
4552 background: ${ props => props . theme . secondary } ;
4653 ` ;
4754
55+ const W2 = styled . default ( Wrapper ) `
56+ color: red;
57+ ` ;
58+
59+ const W3 = styled . default ( W2 ) `
60+ &:hover {
61+ background: ${ props => props . theme . primary } ;
62+ }
63+ `
64+
65+ const Btn = styled . default ( 'button' , { visible : Boolean } ) `
66+ background-color: red;
67+ opacity: ${ props => props . visible ? 1 : 0 } ;
68+ `
69+
70+ const SuperBtn = styled . default ( Btn , { visible : Boolean , big : Boolean } ) `
71+ font-size: ${ props => props . big ? 22 : 18 } px;
72+ `
73+
4874 new Vue ( {
4975 el : '#container' ,
5076 template : `
@@ -53,12 +79,14 @@ <h1>Basic Example</h1>
5379 secondary: 'papayawhip'
5480 }">
5581 <wrapper>
56- <custom-title> Hello World, this is my first styled component! </custom-title>
82+ <custom-title> Hello World, this is my first styled component! </custom-title>
83+ <btn visible> Button </btn>
5784 </wrapper>
5885 </theme-provider>` ,
5986 components : {
60- 'custom-title' : CustomTitle ,
61- wrapper : Wrapper ,
87+ 'custom-title' : H2 ,
88+ wrapper : W3 ,
89+ btn : SuperBtn ,
6290 'theme-provider' : styled . ThemeProvider
6391 } ,
6492 } ) ;
0 commit comments