-
Notifications
You must be signed in to change notification settings - Fork 0
/
compose.js
151 lines (145 loc) · 3.92 KB
/
compose.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import { container, row } from "./src/components/container";
import header from "./src/components/Feature/header";
import hero from "./src/components/Hero/hero";
import link from "./src/components/link";
import feature from "./src/components/Feature/feature";
import image from "./src/components/Image/image";
import { tabs } from "./src/components/Tab/tab";
import { exampleTabs } from "./src/components/Tab/exampleHelper";
import { accordion, demoAccordions } from "./src/components/Accordion/accordion";
import { init as videoInit } from "./src/components/Video/video";
import { position as gridLocation } from "./src/helpers/grid-position";
import { divider as sectionDivider } from "./src/helpers/divider";
const EXAMPLE_TXT = {
long: `Lorem ipsum dolor, sit amet consectetur adipisicing elit. Dolore molestias quos libero inventore quisquam vel, maiores ipsam eum dolorum maxime recusandae doloremque`,
short: `Lorem ipsum, dolor sit amet consectetur adipisicing elit. Quia impedit natus eveniet voluptatibus.`
};
// Hero section
export const heroImages = () => {
return (
container(
header(`Vanilla JS Component Library`, `h1`),
header(`hero`, `h2`)
) +
hero(
container(
row(
`full`,
`<h3 style="font-weight:bold">BOLD STATEMENT</h3><p class="hero-style">${
EXAMPLE_TXT.long
}<br/>
${link(`Read More...`, `#home`)}</p>`
)
)
)
);
}
// Grid system using CSS grid
export const grids = () => {
return (
container(
sectionDivider(),
header(`grid system`, `h2`),
row(
`thirds`,
`<p>${EXAMPLE_TXT.long}</p>`,
`<p>${EXAMPLE_TXT.long}</p>`,
`<p>${EXAMPLE_TXT.long}</p>`
),
row(`halves`, `<p style="${gridLocation(2)}">${EXAMPLE_TXT.long}</p>`),
row(
`quarters`,
`<p style="${gridLocation(1)}">${EXAMPLE_TXT.short}</p>`,
`<p style="${gridLocation(4)}">${EXAMPLE_TXT.short},</p>`
),
row(
`fifths`,
`<p style="${gridLocation(1)}">${EXAMPLE_TXT.short}</p>`,
`<p style="${gridLocation(2)}">${EXAMPLE_TXT.short}</p>`,
`<p style="${gridLocation(3)}">${EXAMPLE_TXT.short}</p>`
)
) +
container(
header(`featured cards`, `h2`),
row(
`thirds`,
feature(
{
title: `Feature 1`,
description: `${EXAMPLE_TXT.long}`,
location: `1`
},
false
),
feature(
{
title: `Feature 2`,
description: `${EXAMPLE_TXT.long}`,
location: `2`
},
false
),
feature(
{
title: `Feature 3`,
description: `${EXAMPLE_TXT.long}`,
location: `3`
},
true
)
),
sectionDivider()
)
);
}
// Images with text
export const images = () => {
return container(
header(`image & text`, `h2`),
row(
`halves`,
`<p style="${gridLocation(2)}">${EXAMPLE_TXT.long}</p>`,
image({
source: `https://source.unsplash.com/`,
alt: `Seoul at Night`,
size: `300x300/?seoul,city`
})
),
row(
`halves`,
`<p style="${gridLocation(1)}">${EXAMPLE_TXT.long}</p>`,
image({
source: `https://source.unsplash.com/`,
alt: `Busan at Night`,
size: `300x300/?busan,city`
})
),
sectionDivider()
);
}
// Tabs
export const tabAccordions = () => {
return (
container(
row(`full`, header(`accordions & tabs`, `h2`), tabs(exampleTabs(), `tabs`))
) +
container(
row(`full`, accordion(demoAccordions())
),
sectionDivider())
);
}
// Videos
export const videos = () => {
return container(
row(
`full`,
header(`video`, `h2`),
videoInit(
`/sample.990d2386.mp4`,
`Video by Miguel Á. Padriñán from Pexels`
)
),
sectionDivider()
);
}