返回 marp
Features.tsx
根目录 / website / components / top / Features.tsx
1 import {
2 CodeSquareIcon,
3 FileIcon,
4 HeartFillIcon,
5 MarkdownIcon,
6 PackageIcon,
7 PaintbrushIcon,
8 PlugIcon,
9 } from '@primer/octicons-react'
10 import type { ReactElement } from 'react'
11
12 type CardProps = React.PropsWithChildren<{
13 name: string
14 icon: string | ReactElement
15 index: number
16 }>
17
18 const Card: React.FC<CardProps> = ({ children, name, icon, index }) => {
19 let cardIcon = icon
20
21 if (typeof icon === 'string') {
22 cardIcon = <img src={icon} alt={name} width={48} height={48} />
23 }
24
25 return (
26 <section className="card">
27 <div>
28 <div className="card-icon">{cardIcon}</div>
29 <h2 className="text-gradient my-4 text-center text-2xl font-semibold">
30 {name}
31 </h2>
32 <p className="text-sm lg:text-base">{children}</p>
33 </div>
34 <style jsx>{`
35 .card {
36 @apply relative z-10 mx-4 my-8 mb-0 flex items-center justify-center rounded-lg bg-white p-6 shadow-lg;
37
38 grid-column: 1;
39 }
40
41 .card-icon {
42 @apply my-2 text-center text-gray-700;
43 }
44
45 .card-icon :global(svg),
46 .card-icon :global(img) {
47 @apply inline h-12 w-12 lg:h-16 lg:w-16;
48 }
49
50 @screen md {
51 .card {
52 grid-row: ${index + 1} / span 2;
53 }
54
55 .card:first-child {
56 @apply mt-0;
57 }
58
59 .card:nth-of-type(even) {
60 grid-column: 2;
61 }
62 }
63 `}</style>
64 </section>
65 )
66 }
67
68 const cards = [
69 ({ index }) => (
70 <Card
71 index={index}
72 name="Based on CommonMark"
73 icon={<MarkdownIcon verticalAlign="top" />}
74 >
75 If you know how to write a document with Markdown, you already know how to
76 write a Marp slide deck. Marp&apos;s format is based on{' '}
77 <a
78 href="https://commonmark.org/"
79 target="_blank"
80 rel="noopener noreferrer"
81 >
82 CommonMark
83 </a>
84 , a consistent Markdown specification. The only important difference is{' '}
85 <a
86 href="https://marpit.marp.app/markdown"
87 rel="noopener noreferrer"
88 target="_blank"
89 >
90 a ruler <code>---</code> for splitting pages.
91 </a>
92 </Card>
93 ),
94 ({ index }) => (
95 <Card
96 index={index}
97 name="Directives and extended syntax"
98 icon={<CodeSquareIcon verticalAlign="top" />}
99 >
100 Sometimes simple text content isn&apos;t enough to emphasize your voice,
101 so Marp supports a variety of{' '}
102 <a
103 href="https://marpit.marp.app/directives"
104 rel="noopener noreferrer"
105 target="_blank"
106 >
107 directives
108 </a>{' '}
109 and extended syntax (
110 <a
111 href="https://marpit.marp.app/image-syntax"
112 rel="noopener noreferrer"
113 target="_blank"
114 >
115 image syntax
116 </a>
117 ,{' '}
118 <a
119 href="https://github.com/marp-team/marp-core#math-typesetting"
120 rel="noopener noreferrer"
121 target="_blank"
122 >
123 math typesetting
124 </a>
125 ,{' '}
126 <a
127 href="https://github.com/marp-team/marp-core#auto-scaling-features"
128 rel="noopener noreferrer"
129 target="_blank"
130 >
131 auto-scaling
132 </a>
133 , etc...) to create beautiful slides.
134 </Card>
135 ),
136 ({ index }) => (
137 <Card
138 index={index}
139 name="Built-in themes and CSS theming"
140 icon={<PaintbrushIcon verticalAlign="top" />}
141 >
142 <a
143 href="https://github.com/marp-team/marp-core/"
144 rel="noopener noreferrer"
145 target="_blank"
146 >
147 Our core engine
148 </a>{' '}
149 has{' '}
150 <a
151 href="https://github.com/marp-team/marp-core/tree/main/themes"
152 rel="noopener noreferrer"
153 target="_blank"
154 >
155 3 built-in themes called <code>default</code>, <code>gaia</code>, and{' '}
156 <code>uncover</code>
157 </a>
158 , to tell your story beautifully. If you&apos;d rather customize your
159 design, you can use Marp to{' '}
160 <a
161 href="https://marpit.marp.app/theme-css?id=tweak-style-through-markdown"
162 rel="noopener noreferrer"
163 target="_blank"
164 >
165 tweak styles with Markdown
166 </a>
167 , or{' '}
168 <a
169 href="https://marpit.marp.app/theme-css"
170 rel="noopener noreferrer"
171 target="_blank"
172 >
173 create your own Marp theme with plain CSS
174 </a>
175 .
176 </Card>
177 ),
178 ({ index }) => (
179 <Card
180 index={index}
181 name="Export to HTML, PDF, and PowerPoint"
182 icon={<FileIcon verticalAlign="top" />}
183 >
184 Have you finished writing? It&apos;s time to share your deck! Marp can
185 convert Markdown into presentation-ready HTML, PDF and PowerPoint files
186 directly! (Powered by{' '}
187 <a
188 href="https://www.google.com/chrome/"
189 rel="noopener noreferrer"
190 target="_blank"
191 >
192 Google Chrome
193 </a>{' '}
194 /{' '}
195 <a
196 href="https://www.chromium.org/Home"
197 rel="noopener noreferrer"
198 target="_blank"
199 >
200 Chromium
201 </a>
202 )
203 </Card>
204 ),
205 ({ index }) => (
206 <Card
207 index={index}
208 name="Marp family: The official toolset"
209 icon={<PackageIcon verticalAlign="top" />}
210 >
211 The Marp ecosystem contains a rich toolset to assist your work.{' '}
212 <a
213 href="https://marketplace.visualstudio.com/items?itemName=marp-team.marp-vscode"
214 rel="noopener noreferrer"
215 target="_blank"
216 >
217 <b>Marp for VS Code</b>
218 </a>{' '}
219 is an extension that allows you to edit and preview slide Markdown and
220 custom theming within VS Code.{' '}
221 <a
222 href="https://github.com/marp-team/marp-cli/"
223 rel="noopener noreferrer"
224 target="_blank"
225 >
226 <b>Marp CLI</b>
227 </a>{' '}
228 is a command line tool allows you to convert Markdown with a simple CLI
229 interface.{' '}
230 <a
231 href="https://github.com/marp-team/marp/"
232 rel="noopener noreferrer"
233 target="_blank"
234 >
235 ... and much more!
236 </a>
237 </Card>
238 ),
239 ({ index }) => (
240 <Card
241 index={index}
242 name="Pluggable architecture"
243 icon={<PlugIcon verticalAlign="top" />}
244 >
245 As a matter of fact,{' '}
246 <em>Marp is essentially just a converter for Markdown.</em> The Marp
247 ecosystem is built on{' '}
248 <a
249 href="https://marpit.marp.app"
250 rel="noopener noreferrer"
251 target="_blank"
252 >
253 <b>the Marpit framework</b>
254 </a>
255 , a skinny framework for creating HTML/CSS slide decks. It has a pluggable
256 architecture and any developer can{' '}
257 <a
258 href="https://marpit.marp.app/usage?id=extend-marpit-by-plugins"
259 rel="noopener noreferrer"
260 target="_blank"
261 >
262 extend features via plugins
263 </a>
264 .
265 </Card>
266 ),
267 ({ index }) => (
268 <Card
269 index={index}
270 name="Fully open-source"
271 icon={<HeartFillIcon verticalAlign="top" />}
272 >
273 The Marp team loves open source! All tools and related libraries are built
274 by{' '}
275 <a
276 href="https://github.com/marp-team"
277 rel="noopener noreferrer"
278 target="_blank"
279 >
280 the Marp team
281 </a>{' '}
282 and are MIT-licensed.
283 </Card>
284 ),
285 ]
286
287 export const Features = () => (
288 <div className="features">
289 <div className="features-grid container">
290 {cards.map((Card, i) => (
291 <Card index={i} key={i} />
292 ))}
293 </div>
294 <style jsx>{`
295 .features {
296 @apply relative py-5;
297 }
298
299 .features::before {
300 @apply absolute inset-0 block;
301
302 background-image: var(--noise-image),
303 linear-gradient(
304 -8deg,
305 rgba(120, 197, 233, 0),
306 rgba(120, 197, 233, 0) 50%,
307 rgba(120, 197, 233, 0.5)
308 );
309 clip-path: polygon(0 15vw, 100% 0, 100% 100%, 0 100%);
310 content: '';
311 }
312
313 .features-grid {
314 @apply mx-auto grid px-4;
315
316 grid-template-columns: 1fr;
317 grid-template-rows: repeat(${cards.length + 1}, auto);
318 }
319
320 @screen md {
321 .features-grid {
322 grid-template-columns: 1fr 1fr;
323 }
324 }
325 `}</style>
326 </div>
327 )
328
328 lines Plain Text