Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@curve-technology/web-ds
Advanced tools
Install @curve-technology/web-ds
and its peerDependencies
$ yarn install @curve-technology/web-ds theme-ui @emotion/core
The package exposes different entrypoints for each sub-package. Below are all the possible entrypoints that can currently be used.
@curve-technology/web-ds
- main entrypoint for the design system theme@curve-technology/web-ds/tokens
- only the design tokens@curve-technology/web-ds/icons
- icons@curve-technology/web-ds/styles
- global styles@curve-technology/web-ds/styleguide
- styleguide components for use in other apps@curve-technology/web-ds/components
- custom componentsThis entrypoint has most, but not all, of the exported components and variables from web-ds
package.
import { theme } from '@curve-technology/web-ds'
The theme can be imported like so:
import { theme } from '@curve-technology/web-ds'
Source files are located in the
src/theme
directory.
The package is heavily reliant on Theme UI. Many of the components and styles need Theme UI in order to work.
Theme UI provides a constraint-based approach to component creation and theming. This allows you and your team to create a design system that supports the widest
To fully understand Theme UI and all that it provides, please read and understand the documentation at https://theme-ui.com/getting-started.
The theme matches Theme UI's specifications, so includes all the colour, font, sizing and spacing information that your app should need.
All theme-related files are located in the src/theme
directory.
Add the theme to your application with the ThemeProvider
, passing in the theme object as a prop.
import React from 'react'
import { ThemeProvider } from 'theme-ui'
import { theme } from '@curve-technology/web-ds'
export default (props) => (
<ThemeProvider theme={theme}>{props.children}</ThemeProvider>
)
This is an example of how a new component could be created without using Emotion's styled.div
syntax. Read more about this method in the Theme UI docs
/** @jsx jsx */
import { jsx } from 'theme-ui'
import { FunctionComponent } from 'react'
export const Title: FunctionComponent = ({ children }) => (
<h1
sx={{
color: 'primary',
fontFamily: 'heading',
}}
>
{children}
</h1>
)
If you're still using the `sx` prop and you need to customise either the property, timing function or duration, or all of them, use something like this:
```tsx
<Box
sx={{
transform: (theme): string =>
`transform ${theme.motion.durations.long} ${
theme.motion.easings.easeInOutQuad
}`,
// `transform 500ms cubic-bezier(0.45, 0, 0.55, 1)`
}}
/>
If you're not using the sx
prop or you're defining a transition another way, you can import the tokens directly and compose your transtion however you like:
import { motion } from '@curve-technology/web-ds/tokens'
const transition = `transform ${motion.durations.short} ${motion.easings.easeOutSine}`
Two fonts should be used with this design system: "Helvetica Now" and "Eloquent".
Helvetica Now's font files need to be self-hosted. Ensure that they are placed in the /fonts
directory of your application's static directory when hosted. Use body
as the value when using the sx
prop, like so:
<div sx={{ fontFamily: 'body' }}>Normal text</div>
Eloquent is the bold serif font used with Curve. Use fancy
as the value when using the sx
prop, like so:
<div sx={{ fontFamily: 'fancy' }}>Fancy text</div>
Ensure your application adds this link
tag so that the font can be used:
<link rel="stylesheet" href="https://use.typekit.net/eld0ezk.css" />
Theme UI includes pre-built UI components to make styling a page with Theme UI quicker. This package includes components for layouts, grids, buttons, form elements, and more.
import { Box } from 'theme-ui'
export const SomeComponent = (
<Box p={4} color="white" bg="primary">
Beep
</Box>
)
Find out more in the Theme UI component docs.
Source files are located in the
src/components
directory.
import { ArrowLink } from '@curve-technology/web-ds/components'
Source files are located in the
src/tokens
directory.
Design tokens are an important part of any design system, so this repo exposes all of the "raw" design tokens so you can use them whenever you need to.
import {
breakpoints,
colors,
fontFamilies,
fontSizes,
motion,
radii,
space,
zIndices,
shadows,
} from '@curve-technology/web-ds/tokens'
Theme UI takes care of tokens using it's theme object and is the basis for your components and applications consuming your components.
Source files are located in the
src/icons
directory.
import {
CurveLogo,
CurveBrandmark,
ArrowEast,
} from '@curve-technology/web-ds/icons'
Theme UI's sx
prop can be used to add extra styles and to change the colour of icons; this works because the underlying svg's fill
or stroke
value is set to currentColor
. e.g.
<ArrowEast size="50" sx={{ color: 'accent' }} />
Source files are located in the
src/styles
directory.
These styles are to be used to add common, usually global styles to your applications. So far these styles are:
reset
: A CSS reset using the modern CSS resetfontFace
: The @font-face
directive for use with Helvetica NowresponsiveFontSizing
: When using rem
unit for font-size and spacing, this set of styled increases the :root
font-size so that these values increase based on the user's viewport widthThey can be used in emotion's Global
component, like so:
import { Global } from '@emotion/core'
import {
reset,
fontFace,
responsiveFontSizing,
} from '@curve-technology/web-ds/styles'
export default class MyApp extends App {
render(): JSX.Element {
const { Component, pageProps } = this.props
return (
<ThemeProvider theme={theme}>
<Global styles={[reset, fontFace, responsiveFontSizing]} />
<Component {...pageProps} />
</ThemeProvider>
)
}
}
Source files are located in the
src/styleguide
directory.
The styleguide entrypoint contains components are to be used inside a 3rd party app's Storybook config. They provide an example of what the theme's base components look like.
import {
Styleguide,
Tokens,
ThemeConfig,
} from '@curve-technology/web-ds/styleguide'
The Styledguide
component has examples for most base components, like typography, form elements and buttons.
The Tokens
component displays all the tokens (colour palette, font-sizes, spacing values etc).
The ThemeConfig
prints the entire theme onto the page. This is useful to see the raw values for the Theme UI theme that your app is using.
import React, { FunctionComponent } from 'react'
import {
Styleguide,
Tokens,
ThemeConfig,
} from '@curve-technology/web-ds/styleguide'
import { theme } from '@curve-technology/web-ds'
export default {
title: 'Design system',
}
export const styleguide: FunctionComponent = () => <Styleguide />
export const tokens: FunctionComponent = () => <Tokens />
export const themeConfig: FunctionComponent = () => (
<ThemeConfig theme={theme} />
)
See an example of these in action here and here
Test files use *.test.ts(x)
or *.spec.ts(x)
Any file with *.story.tsx
or *.stories.tsx
, or *.story.mdx
or *.stories.mdx
can be used by Storybook. The *.mdx
extensions are used for documentation.
E.g. a Button
found in the /src/components
directory.
.
├── CookieBanner.tsx // < component code
├── README.md // < component documentation
├── CookieBanner.story.tsx // < component story
├── CookieBanner.test.tsx // < component tests
├── CookieBanner.models.ts // < component tests
├── __snapshots__ // < auto-generated snapshot files
└── index.ts // < component entry file
The package uses Preconstruct to bundle all its source code. Please consult their docs if you need to update/improve the build process.
yarn build
: Compile a production buildyarn build:dev
: Compile a development buildyarn storybook
: Run Storybook development environmentyarn format
: Format all JS with Prettieryarn lint
: Lint JSyarn size
: Test the file size of the buildyarn test
: Run all testsyarn test:js
: Run all JS tests with Jestyarn test:coverage
: Run a code coverage test with Jestyarn test:watch
: Run test suite while watching for changesyarn release
: Publish a new package version to npmThe design system uses various tools to ensure better code quality. Defaults have been set for linting and code style, but can easily be overridden according to your needs.
All git commits and pull request titles should follow the Conventional Commits method. This will allow our release script to correctly bump the package version number appropriately.
Running yarn release
while on an up-to-date and clean master
branch will update the CHANGELOG and publish to npm.
Made by Curve's web scientists 👨🔬
FAQs
Curve Atomic Design System for Web ✌️
The npm package @curve-technology/web-ds receives a total of 0 weekly downloads. As such, @curve-technology/web-ds popularity was classified as not popular.
We found that @curve-technology/web-ds demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.