返回 marp
GetStarted.tsx
根目录 / website / components / top / GetStarted.tsx
1 import classNames from 'classnames'
2 import { Button } from 'components/Button'
3
4 type CardProps = React.PropsWithChildren<{
5 badge?: string
6 className?: string
7 description: string
8 href: string
9 name: string
10 screenShot?: string
11 ssWidth?: number
12 ssHeight?: number
13 summary: string
14 }>
15
16 const Card: React.FC<CardProps> = ({
17 badge,
18 children,
19 className,
20 description,
21 href,
22 name,
23 screenShot: screenshot,
24 ssWidth,
25 ssHeight,
26 summary,
27 }) => (
28 <section className={classNames('card', className, { screenshot })}>
29 <a
30 href={href}
31 target="_blank"
32 rel="noopener noreferrer"
33 className="custom-anchor card-link"
34 >
35 <h4 className="text-gradient inline-block pr-3 pb-1 text-xl font-bold sm:text-2xl md:text-3xl">
36 {name}
37 </h4>
38 {badge && (
39 <img
40 src={badge}
41 alt=""
42 className="inline rounded-sm align-text-top sm:align-baseline"
43 loading="lazy"
44 />
45 )}
46 <p className="pt-1 text-sm leading-tight text-gray-700">{summary}</p>
47 </a>
48 {screenshot && (
49 <figure>
50 <img
51 src={screenshot}
52 alt={name}
53 loading="lazy"
54 width={ssWidth}
55 height={ssHeight}
56 />
57 </figure>
58 )}
59 <p className="mx-5 lg:my-3">{description}</p>
60 <p className="mx-5 my-4 text-sm">{children}</p>
61 <style jsx>{`
62 .card {
63 @apply text-foreground relative my-8 grid overflow-hidden rounded-lg bg-white p-2 shadow-xl;
64
65 grid-template-columns: 1fr;
66 }
67 .card::before {
68 @apply absolute right-0 h-40 w-40 transform bg-contain bg-center bg-no-repeat opacity-25;
69
70 content: '';
71 top: -2rem;
72 transform: rotate(-15deg);
73 }
74 .card.vscode::before {
75 background-image: url('https://icongr.am/simple/visualstudiocode.svg?color=67b8e3');
76 }
77 .card.cli::before {
78 background-image: url('https://icongr.am/octicons/terminal.svg?color=67b8e3');
79 }
80 .card.core::before {
81 background-image: url('/assets/marp-logo.svg');
82 }
83 .card.marpit::before {
84 background-image: url('/assets/marpit.svg');
85 }
86 .card > * {
87 @apply relative col-start-1 col-end-1;
88 }
89 .card > figure {
90 @apply mx-auto flex items-center justify-center p-4;
91 }
92 .card > figure > img {
93 @apply max-w-full;
94
95 width: 28rem;
96 }
97
98 .card-link {
99 @apply relative z-10 block rounded p-5 transition-all duration-150;
100 }
101 .card-link:hover,
102 .card-link:focus {
103 @apply shadow;
104
105 background-color: rgba(255, 255, 255, 0.5);
106 }
107 .card-link:hover:active,
108 .card-link:focus {
109 @apply duration-0 outline-none ring-1 ring-white ring-offset-2;
110 }
111
112 @screen lg {
113 .card.screenshot {
114 grid-template-columns: 3fr 2fr;
115 }
116 .card > figure {
117 @apply col-start-2 col-end-2 h-full w-full object-contain px-6 py-0;
118
119 grid-row: 1 / span 9999;
120 }
121 .card::before {
122 @apply h-64 w-64;
123
124 top: -4rem;
125 }
126 }
127
128 @screen xl {
129 .card {
130 @apply mx-auto w-5/6;
131 }
132 }
133 `}</style>
134 </section>
135 )
136
137 export const GetStarted = () => (
138 <>
139 <div id="get-started" className="get-started flow-root">
140 <section className="container mx-auto py-10 px-8 lg:px-16">
141 <h3 className="text-center text-2xl font-bold sm:text-3xl">
142 <mark>Tools and integrations</mark>
143 </h3>
144 <Card
145 description="Enhance VS Code's Markdown preview pane to support writing your beautiful presentations. You can preview the slide deck output as soon as you edit its Markdown."
146 name="Marp for VS Code"
147 summary="Create slide decks written in Marp Markdown right in VS Code"
148 badge="https://img.shields.io/github/v/release/marp-team/marp-vscode.svg?style=flat-square&amp;label=&amp;color=0288d1"
149 href="https://marketplace.visualstudio.com/items?itemName=marp-team.marp-vscode"
150 screenShot="/assets/marp-for-vs-code.png"
151 ssWidth={1946}
152 ssHeight={1424}
153 className="vscode"
154 >
155 <Button
156 color="primary"
157 className="mr-2 mb-2"
158 href="https://marketplace.visualstudio.com/items?itemName=marp-team.marp-vscode"
159 target="_blank"
160 rel="noopener noreferrer"
161 >
162 VS Marketplace
163 </Button>
164 <Button
165 outline
166 className="mr-2 mb-2"
167 href="https://github.com/marp-team/marp-vscode"
168 target="_blank"
169 rel="noopener noreferrer"
170 >
171 GitHub
172 </Button>
173 </Card>
174 <Card
175 description="The Marp CLI is the swiss army knife of the Marp ecosystem. Convert your Markdown into various formats, watch changes, launch server for on-demand conversion, and customize the core engine."
176 name="Marp CLI"
177 summary="A CLI interface for Marp and Marpit based converters"
178 badge="https://img.shields.io/npm/v/@marp-team/marp-cli.svg?style=flat-square&amp;label=&amp;color=0288d1"
179 href="https://github.com/marp-team/marp-cli"
180 screenShot="/assets/marp-cli.png"
181 ssWidth={1400}
182 ssHeight={800}
183 className="cli"
184 >
185 <Button
186 color="primary"
187 className="mr-2 mb-2"
188 href="https://github.com/marp-team/marp-cli/releases"
189 target="_blank"
190 rel="noopener noreferrer"
191 >
192 Releases
193 </Button>
194 <Button
195 outline
196 color="primary"
197 className="mr-2 mb-2"
198 href="https://www.npmjs.com/package/@marp-team/marp-cli"
199 target="_blank"
200 rel="noopener noreferrer"
201 >
202 npm
203 </Button>
204 <Button
205 outline
206 className="mr-2 mb-2"
207 href="https://github.com/marp-team/marp-cli"
208 target="_blank"
209 rel="noopener noreferrer"
210 >
211 GitHub
212 </Button>
213 </Card>
214 <h3 className="text-center text-2xl font-bold sm:text-3xl">
215 <mark>For developers</mark>
216 </h3>
217 <Card
218 description="All official Marp tooling uses this core as the engine. It is based on the Marpit framework and includes some extra features to help create beautiful slide decks."
219 name="Marp Core"
220 summary="The core of the Marp converter"
221 badge="https://img.shields.io/npm/v/@marp-team/marp-core.svg?style=flat-square&amp;label=&amp;color=0288d1"
222 href="https://github.com/marp-team/marp-core"
223 className="core"
224 >
225 <Button
226 outline
227 color="primary"
228 className="mr-2 mb-2"
229 href="https://www.npmjs.com/package/@marp-team/marp-core"
230 target="_blank"
231 rel="noopener noreferrer"
232 >
233 npm
234 </Button>
235 <Button
236 outline
237 className="mr-2 mb-2"
238 href="https://github.com/marp-team/marp-core"
239 target="_blank"
240 rel="noopener noreferrer"
241 >
242 GitHub
243 </Button>
244 </Card>
245 <Card
246 description="Marpit (independent from Marp) is the framework that transforms Markdown and CSS themes to slide decks composed of HTML/CSS. It is optimized to output only the minimum set of assets required."
247 name="Marpit framework"
248 summary="The skinny framework for creating slide decks from Markdown"
249 badge="https://img.shields.io/npm/v/@marp-team/marpit.svg?style=flat-square&amp;label=&amp;color=0288d1"
250 href="https://marpit.marp.app/"
251 className="marpit"
252 >
253 <Button
254 color="primary"
255 className="mr-2 mb-2"
256 href="https://marpit.marp.app/"
257 target="_blank"
258 rel="noopener noreferrer"
259 >
260 Documentation
261 </Button>
262 <Button
263 outline
264 color="primary"
265 className="mr-2 mb-2"
266 href="https://www.npmjs.com/package/@marp-team/marpit"
267 target="_blank"
268 rel="noopener noreferrer"
269 >
270 npm
271 </Button>
272 <Button
273 outline
274 className="mr-2 mb-2"
275 href="https://github.com/marp-team/marpit"
276 target="_blank"
277 rel="noopener noreferrer"
278 >
279 GitHub
280 </Button>
281 </Card>
282 <p className="mt-4 text-center">
283 Find all of the Marp tools, integrations, and examples in the GitHub
284 repository!
285 </p>
286 <p className="text-foreground mt-4 text-center text-sm">
287 <Button
288 href="https://github.com/marp-team/marp/"
289 rel="noopener"
290 target="_blank"
291 >
292 Check out Marp GitHub repository...
293 </Button>
294 </p>
295 </section>
296 </div>
297 <style jsx>{`
298 .get-started {
299 @apply bg-marp-brand relative text-white;
300
301 background-image: var(--noise-image),
302 linear-gradient(
303 -2deg,
304 theme('colors.marp.darken'),
305 theme('colors.marp.brand') 500px
306 );
307 }
308
309 .get-started::before,
310 .get-started::after {
311 @apply absolute inset-x-0 block;
312
313 background-image: var(--noise-image),
314 linear-gradient(to bottom, rgba(255, 255, 255, 0.4), transparent 95%);
315 bottom: calc(100% - 5px);
316 content: '';
317 transform: translateZ(0);
318 z-index: -1;
319 }
320
321 .get-started::before {
322 @apply bg-marp-light;
323
324 clip-path: polygon(0 0, 100% 90%, 100% 100%, 0 100%);
325 height: calc(120px + 5vw);
326 }
327
328 .get-started::after {
329 @apply bg-marp-brand;
330
331 clip-path: polygon(0 0, 100% 95%, 100% 100%, 0 100%);
332 height: calc(60px + 5vw);
333 }
334 `}</style>
335 </>
336 )
337
337 lines Plain Text