As of today yadsy is simply the infrastructure of a design system for my own use and education. Who knows what it might become. The rest of this readme reflects what it might could be, and works as documentation for my self.
A modular, accessible design system built with React. YADSY provides a collection of reusable components and design tokens to help you build consistent user interfaces.
npm install yadsyimport { Button } from 'yadsy';
import 'yadsy/dist/tokens/tokens.css';
function App() {
return (
<Button variant="primary" size="medium">
Click Me
</Button>
);
}YADSY includes a not so comprehensive and well though through set of design tokens for:
- Colors: Primary, secondary, and semantic color palettes
- Typography: Font families, sizes, weights, and line heights
- Spacing: Consistent spacing values
- Borders: Border radii and widths
- Shadows: Elevation levels
These are mainly fillers or placeholders as of today, though they are used in the components.
TODO: change tokens according to best practice. TODO: create a more inspiring color pallet.
You can override the CSS variables in your CSS file:
.custom-button {
--color-primary-500: #ff5500;
--border-radius-md: 0.5rem;
}Or use the tokens directly as javascript:
import { Button, colors, spacing, border } from 'yadsy';
import './App.css';
function App() {
const customStyle = {
backgroundColor: colors.secondary[700],
padding: `${spacing[2]} ${spacing[4]}`,
borderRadius: border.radius.lg,
};
return (
<div style={{ padding: spacing[4] }}>
<Button
onClick={() => console.log('Jeg er yadsy')}
size="large"
style={customStyle}
>
I am yadsy
</Button>
</div>
);
}Or create your own custom button
import { Button } from 'yadsy';
import './App.css';
function CustomButton(props) {
return (
<Button
{...props}
className={`custom-themed-button ${props.className || ''}`}
/>
);
}
function App() {
return (
<CustomButton onClick={() => console.log('I am yadsy')} size="large">
I am yadsy
</CustomButton>
);
}with corresponding css:
.custom-themed-button.yadsy-button--primary {
background-color: var(--color-secondary-700);
color: var(--color-white);
}
.custom-themed-button.yadsy-button--primary:hover:not(:disabled) {
background-color: var(--color-secondary-800);
}- Clone the repository
- Install dependencies:
npm install - Start Storybook:
npm run storybook
npm run build: Build the packagenpm run build:clean: Build the package after cleaning up folders. Recommended in dev to avoid false positivesnpm run test: Run testsnpm run lint: Run lintingnpm run format: Format code with Prettiernpm run storybook: Start Storybook development environment
TODO: add watch scripts for dev TODO: add deployment of Storybook?
- Create a new branch from
main - Make your changes
- Add tests for your changes
- Run
npm run lintandnpm run testto ensure your changes pass linting and tests
We use changesets to manage versions and package releases.
- Run
npm run changesetto create a new changeset - Follow the prompts to select the type of change (patch, minor, major)
- Write a summary of the changes
- Commit the generated changeset file with your changes
Example:
npm run changeset
# Select the appropriate version bump
# Add a summary of your changes
git add .
git commit -m "feat: add new component"
git pushOur CI/CD pipeline will automatically:
- Create a release PR when changesets are merged to main
- Publish to npm when the release PR is merged
ISC