Skip to content

Commit b249a56

Browse files
authored
Add starter kit download link to the docs (#5450)
1 parent a3d77ab commit b249a56

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

packages/dev/docs/pages/react-aria/getting-started.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export default Layout;
1212

1313
import ChevronRight from '@spectrum-icons/workflow/ChevronRight';
1414
import styles from '@react-spectrum/docs/src/docs.css';
15+
import {ResourceCard} from '@react-spectrum/docs/src/ResourceCard';
16+
import {spawnSync} from 'child_process';
1517

1618
---
1719
category: Introduction
@@ -218,6 +220,15 @@ This is a quick way to get started, but you can also create your own custom clas
218220

219221
Check out our [styling guide](styling.html) to learn more about styling, states, render props, working with Tailwind CSS, and animation.
220222

223+
## Starter kit
224+
225+
To help kick-start your project, we offer a starter kit that includes example implementations of all React Aria components, along with styles from the docs. It also comes with a pre-configured [Storybook](https://storybook.js.org/) that you can experiment with, or use as a starting point for your own component library.
226+
227+
<ResourceCard
228+
type="Storybook"
229+
url={`../react-aria-starter.${process.env.GIT_HASH || spawnSync('git', ['rev-parse', '--short', 'HEAD']).stdout}.zip`}
230+
style={{marginTop: 36}} />
231+
221232
## Hooks
222233

223234
React Aria includes both components and hooks depending on the level of customization you need. The components provide a default DOM structure and styling API, and handle all of the glue code necessary to connect the hooks together on your behalf. If you need even more control, you can drop down to the lower-level hook-based API. Check out our [Hooks Introduction](hooks.html) to get started.

packages/dev/docs/src/ResourceCard.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export function ResourceCard(props) {
1919

2020
let {
2121
type,
22-
url
22+
url,
23+
style
2324
} = props;
2425

2526
// set content for source type
@@ -53,10 +54,23 @@ export function ResourceCard(props) {
5354
title: 'View ARIA pattern',
5455
type
5556
};
57+
} else if (type.toLowerCase() === 'storybook') {
58+
cardContent = {
59+
svg: <svg viewBox="0 0 52 64" style={{background: '#FF4785'}}>
60+
<g fill="none" fillRule="evenodd" stroke="none" strokeWidth="1">
61+
<g transform="translate(1.000000, 1.000000)">
62+
<path id="S" fill="#FFF" fillRule="nonzero" d="M29.4029796,23.368648 C29.4029796,24.58142 37.6567008,24.00017 38.7646901,23.1482813 C38.7646901,14.8895929 34.2873503,10.5497821 26.0885852,10.5497821 C17.88982,10.5497821 13.2961856,14.9571143 13.2961856,21.5681161 C13.2961856,33.0822778 28.9959487,33.3026444 28.9959487,39.5830962 C28.9959487,41.3460299 28.1237396,42.3927719 26.2048797,42.3927719 C23.7045471,42.3927719 22.7160434,41.1289316 22.832338,36.8317805 C22.832338,35.8995698 13.2961856,35.6089448 13.0054493,36.8317805 C12.2651161,47.2453073 18.8201763,50.248968 26.3211742,50.248968 C33.5895831,50.248968 39.2880157,46.4144645 39.2880157,39.4729126 C39.2880157,27.132376 23.3556634,27.4629261 23.3556634,21.3477494 C23.3556634,18.8686237 25.2163761,18.5380737 26.3211742,18.5380737 C27.4841196,18.5380737 29.5774214,18.7409467 29.4029796,23.368648 Z" mask="url(#mask-2)" />
63+
<path id="bookmark" fill="#FFF" fillRule="nonzero" d="M37.1272753,7.62078766 L37.4276823,0.591583333 L43.4674595,0.218291667 L43.7276576,7.37468316 C43.7367132,7.6313391 43.5338374,7.84666553 43.2745216,7.85562813 C43.1634862,7.85946584 43.0546693,7.82423279 42.9673936,7.75618537 L40.6382617,5.94019678 L37.880626,8.0105767 C37.6738999,8.16578288 37.3791917,8.12573637 37.2223772,7.92113026 C37.1563661,7.83500129 37.1227378,7.72879963 37.1272753,7.62078766 Z" mask="url(#mask-2)" />
64+
</g>
65+
</g>
66+
</svg>,
67+
title: 'Download starter',
68+
type
69+
};
5670
}
5771

5872
return (
59-
<a href={url} rel="noreferrer" target="_blank" title={cardContent.title} className={styles['resourceCard']} data-hover={styles['is-hovered']}>
73+
<a href={url} rel="noreferrer" target="_blank" title={cardContent.title} className={styles['resourceCard']} data-hover={styles['is-hovered']} style={style}>
6074
<div>
6175
{cardContent.svg}
6276
</div>

scripts/buildWebsite.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const path = require('path');
1717
const glob = require('fast-glob');
1818
const semver = require('semver');
1919
const spawn = require('cross-spawn');
20+
const spawnSync = require('child_process').spawnSync;
2021

2122
build().catch(err => {
2223
console.error(err.stack);
@@ -30,6 +31,7 @@ async function build() {
3031
console.log(`Building into ${dir}...`);
3132

3233
// Generate a package.json containing just what we need to build the website
34+
let gitHash = spawnSync('git', ['rev-parse', '--short', 'HEAD']).stdout;
3335
let pkg = {
3436
name: 'rsp-website',
3537
version: '0.0.0',
@@ -67,7 +69,7 @@ async function build() {
6769
browserslist: packageJSON.browserslist,
6870
scripts: {
6971
// Add a public url if provided via arg (for verdaccio prod doc website build since we want a commit hash)
70-
build: `DOCS_ENV=production PARCEL_WORKER_BACKEND=process parcel build 'docs/*/*/docs/*.mdx' 'docs/react-aria-components/docs/**/*.mdx' 'packages/dev/docs/pages/**/*.mdx' ${publicUrlFlag}`,
72+
build: `DOCS_ENV=production PARCEL_WORKER_BACKEND=process GIT_HASH=${gitHash} parcel build 'docs/*/*/docs/*.mdx' 'docs/react-aria-components/docs/**/*.mdx' 'packages/dev/docs/pages/**/*.mdx' ${publicUrlFlag}`,
7173
postinstall: 'patch-package'
7274
},
7375
'@parcel/transformer-css': packageJSON['@parcel/transformer-css']

0 commit comments

Comments
 (0)