File tree Expand file tree Collapse file tree 12 files changed +322
-12
lines changed Expand file tree Collapse file tree 12 files changed +322
-12
lines changed Original file line number Diff line number Diff line change 2929 v-for =" section in configTransformed"
3030 :key =" section.title"
3131 :href =" `#${section.title}`"
32- class =" block py-2 px-3 text-gray-600 hover:text-teal-600 hover:bg-teal-200 hover:opacity-25 text-base rounded-sm"
32+ class =" block py-2 px-3 text-gray-600 hover:text-gray-900 text-base rounded-sm"
3333 >
3434 {{ section.title }}
3535 </a >
3636 </nav >
3737 <div class =" pr-4" >
38- <CanvasSection v-for =" section in configTransformed" :key =" section.title" :title =" section.title" :id =" section.title" >
39- <component :is =" sectionComponent(section.component)" :data =" section.data" />
38+ <CanvasSection
39+ v-for =" section in configTransformed"
40+ :key =" section.title"
41+ :title =" section.title"
42+ :id =" section.title"
43+ >
44+ <component
45+ :is =" sectionComponent(section.component)"
46+ :data =" section.data"
47+ :config =" config"
48+ />
4049 </CanvasSection >
4150 </div >
4251 </div >
4554</template >
4655
4756<script >
48- import configParser , { transformThemeForCanvas } from ' @/lib/twConfigParser '
57+ import themeComponentMapper from ' @/utils/themeComponentMapper '
4958import CanvasSection from ' ./CanvasSection'
5059import Spacing from ' ./Sections/Spacing'
5160
@@ -66,13 +75,12 @@ export default {
6675 sectionComponent : (component ) => {
6776 return require (` ./Sections/${ component} .vue` ).default
6877 },
78+
6979 fileSelected (e ) {
7080 const fr = new FileReader ()
7181 fr .onload = (e ) => {
72- console .log (e)
73- this .config = configParser (e .target .result )
74- this .configTransformed = transformThemeForCanvas (this .config )
75- console .log (this .config )
82+ this .config = JSON .parse (e .target .result )
83+ this .configTransformed = themeComponentMapper (this .config )
7684 }
7785 fr .readAsText (e .target .files [0 ])
7886 }
Original file line number Diff line number Diff line change 11<template >
22 <section class =" mb-16 max-w-full" >
33 <h1 class =" mb-1 text-4xl text-gray-800" >{{ title }}</h1 >
4- <p class =" mb-4 text-gray-600" >This is the description of the section. You can use it to do cool things.</p >
54 <div class =" bg-white p-6 rounded border-gray-300 border" >
65 <slot />
76 </div >
Original file line number Diff line number Diff line change 88 }"
99 />
1010 <CanvasBlockLabel
11- :label =" `rounded-${prop}`"
11+ :label =" `${removeDefaultSuffix(` rounded-${prop}`) }`"
1212 :value =" value"
1313 />
1414 </div >
1717
1818<script >
1919import CanvasBlockLabel from ' ../CanvasBlockLabel'
20+ import { removeDefaultSuffix } from ' @/utils'
2021
2122export default {
2223 components: {
2324 CanvasBlockLabel
2425 },
26+
2527 props: {
2628 data: {
2729 type: Object ,
2830 required: true
2931 }
32+ },
33+
34+ methods: {
35+ removeDefaultSuffix
3036 }
3137}
3238 </script >
Original file line number Diff line number Diff line change 1212 }"
1313 />
1414 <CanvasBlockLabel
15- :label =" `rounded -${prop}`"
15+ :label =" `${removeDefaultSuffix(`border -${prop}`) }`"
1616 :value =" value"
1717 />
1818 </div >
2121
2222<script >
2323import CanvasBlockLabel from ' ../CanvasBlockLabel'
24+ import { removeDefaultSuffix } from ' @/utils'
2425
2526export default {
2627 components: {
2728 CanvasBlockLabel
2829 },
30+
2931 props: {
3032 data: {
3133 type: Object ,
3234 required: true
3335 }
36+ },
37+
38+ methods: {
39+ removeDefaultSuffix
3440 }
3541}
3642 </script >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" " >
3+ <div
4+ v-for =" (value, prop) in data"
5+ class =" mb-4"
6+ :key =" prop"
7+ >
8+ <div class =" border p-4 rounded" >
9+ <p
10+ class =" mb-2 leading-none text-2xl"
11+ :style =" {
12+ fontWeight: value
13+ }"
14+ >
15+ The quick brown fox jumped over the lazy dog.
16+ </p >
17+ <CanvasBlockLabel
18+ :label =" `font-${prop}`"
19+ :value =" value"
20+ />
21+ </div >
22+ </div >
23+ </div >
24+ </template >
25+
26+ <script >
27+ import CanvasBlockLabel from ' ../CanvasBlockLabel'
28+
29+ export default {
30+ components: {
31+ CanvasBlockLabel
32+ },
33+ props: {
34+ data: {
35+ type: Object ,
36+ required: true
37+ }
38+ }
39+ }
40+ </script >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" " >
3+ <div
4+ v-for =" (value, prop) in data"
5+ :key =" prop"
6+ class =" mb-6"
7+ >
8+ <div
9+ class =" mb-2 bg-gray-400"
10+ :style =" {
11+ height: value
12+ }"
13+ />
14+ <CanvasBlockLabel
15+ :label =" `h-${prop}`"
16+ :value =" value"
17+ />
18+ </div >
19+ </div >
20+ </template >
21+
22+ <script >
23+ import CanvasBlockLabel from ' ../CanvasBlockLabel'
24+
25+ export default {
26+ components: {
27+ CanvasBlockLabel
28+ },
29+ props: {
30+ data: {
31+ type: Object ,
32+ required: true
33+ }
34+ }
35+ }
36+ </script >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div >
3+ <div
4+ v-for =" (value, prop) in data"
5+ :key =" prop"
6+ class =" mb-6"
7+ >
8+ <div class =" mb-2 bg-gray-200" >
9+ <div
10+ class =" bg-gray-400"
11+ :style =" {
12+ maxWidth: value,
13+ height: '100px'
14+ }"
15+ />
16+ </div >
17+ <CanvasBlockLabel
18+ :label =" `max-w-${prop}`"
19+ :value =" value"
20+ />
21+ </div >
22+ </div >
23+ </template >
24+
25+ <script >
26+ import CanvasBlockLabel from ' ../CanvasBlockLabel'
27+
28+ export default {
29+ components: {
30+ CanvasBlockLabel
31+ },
32+ props: {
33+ data: {
34+ type: Object ,
35+ required: true
36+ }
37+ }
38+ }
39+ </script >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" " >
3+ <div
4+ v-for =" (value, prop) in data"
5+ :key =" prop"
6+ class =" mb-6"
7+ >
8+ <div
9+ class =" mb-2 bg-gray-400"
10+ :style =" {
11+ minHeight: value
12+ }"
13+ />
14+ <CanvasBlockLabel
15+ :label =" `min-h-${prop}`"
16+ :value =" value"
17+ />
18+ </div >
19+ </div >
20+ </template >
21+
22+ <script >
23+ import CanvasBlockLabel from ' ../CanvasBlockLabel'
24+
25+ export default {
26+ components: {
27+ CanvasBlockLabel
28+ },
29+ props: {
30+ data: {
31+ type: Object ,
32+ required: true
33+ }
34+ }
35+ }
36+ </script >
Original file line number Diff line number Diff line change 1+ <template >
2+ <div >
3+ <div
4+ v-for =" (value, prop) in data"
5+ :key =" prop"
6+ class =" mb-6"
7+ >
8+ <div class =" mb-2 bg-gray-200" >
9+ <div
10+ class =" bg-gray-400"
11+ :style =" {
12+ maxWidth: value,
13+ height: '100px'
14+ }"
15+ />
16+ </div >
17+ <CanvasBlockLabel
18+ :label =" `min-w-${prop}`"
19+ :value =" value"
20+ />
21+ </div >
22+ </div >
23+ </template >
24+
25+ <script >
26+ import CanvasBlockLabel from ' ../CanvasBlockLabel'
27+
28+ export default {
29+ components: {
30+ CanvasBlockLabel
31+ },
32+ props: {
33+ data: {
34+ type: Object ,
35+ required: true
36+ }
37+ }
38+ }
39+ </script >
Original file line number Diff line number Diff line change 1212 }"
1313 />
1414 <CanvasBlockLabel
15- :label =" `shadow-${prop}`"
15+ :label =" `${removeDefaultSuffix(` shadow-${prop}`) }`"
1616 :value =" value"
1717 />
1818 </div >
2121
2222<script >
2323import CanvasBlockLabel from ' ../CanvasBlockLabel'
24+ import { removeDefaultSuffix } from ' @/utils'
2425
2526export default {
2627 components: {
2728 CanvasBlockLabel
2829 },
30+
2931 props: {
3032 data: {
3133 type: Object ,
3234 required: true
3335 }
36+ },
37+
38+ methods: {
39+ removeDefaultSuffix
3440 }
3541}
3642 </script >
You can’t perform that action at this time.
0 commit comments