Gathering detailed insights and metrics for @lifeondesk/stone-ui
Gathering detailed insights and metrics for @lifeondesk/stone-ui
Gathering detailed insights and metrics for @lifeondesk/stone-ui
Gathering detailed insights and metrics for @lifeondesk/stone-ui
npm install @lifeondesk/stone-ui
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
5
39
Stone-UI is a component library built with TypeScript, React, CSS modules, and Feather icons.
Inspired by: Bamboo-UI
Practices from: Good npm library practices
To add Stone UI to your project, run the following command:
1npm add @lifeondesk/stone-ui 2# or using npm 3npm install @lifeondesk/stone-ui
Stone UI is built using React, so react
and react-dom
are required peer dependencies. If you don't have them installed yet, run the following command in your project:
1npm add react react-dom 2# or using npm 3npm install react react-dom
Stone UI uses CSS modules for styling which are imported into the JavaScript files. A custom loader is needed to make this work.
Popular React frameworks such as Next.js and Create React App support CSS modules out of the box, though you might need additional configuration to enable this for node modules (e.g. next-transpile-modules
).
If you are not using a framework or starter kit with CSS module support, you need to add and configure the css-loader
for Webpack or find a similar loader for your bundler of choice.
Stone UI's components rely on a two global stylesheet to work properly.
theme.css
contains the default CSS variables for both light and dark mode. You can override individual variables or create a custom theme.base.css
contains a small CSS reset and a handful of other global styles such as font-face declarations and custom ::selection
styles.Import the stylesheets in your application globally and before any other imports from Stone UI. For example, in Next.js you should import the stylesheets in the _app.js
file:
1// ./pages/_app.js 2import '@lifeondesk/stone-ui/base.css'; 3import '@lifeondesk/stone-ui/components.css'; 4import '@lifeondesk/stone-ui/theme.css'; 5 6export default function MyApp({ Component, pageProps }) { 7 return <Component {...pageProps} />; 8}
Once the initial setup is done, importing and using the components is straightforward:
1import { Button } from '@lifeondesk/stone-ui'; 2 3function App() { 4 return ( 5 <Button variant="primary" onClick={() => alert('Hello')}> 6 Say hello 7 </Button> 8 ); 9}
You can add custom styles to a component by passing in a className
prop:
1import { Button } from '@lifeondesk/stone-ui'; 2 3function App() { 4 return ( 5 <Button className="spacing-bottom" onClick={() => alert('Hello')}> 6 Say hello 7 </Button> 8 ); 9}
If you have ideas for how I could improve this README or the project in general, let me know. Below are some tips how to make changes to the project:
This project uses npm
to manage its dependencies. Once you've cloned the repository, navigate to the project folder in your terminal and run the following command to install all dependencies:
1npm
I use Storybook as a development workbench and to document the components. To start Storybook and open it in your browser, run the following command:
1npm start
I use stone-toolkit, SumUp's toolkit for building JavaScript & TypeScript applications, to manage the linting and formatting configs. The linter and TypeScript run on every commit to ensure high code quality. You can also lint manually by running the following commands:
1# Lint and report issues 2npm lint 3# Same as above, but also tries to fix issues automatically 4npm lint:fix
The majority of the components are purely visual and TypeScript gives me a high level of confidence in the code. For these reasons and since this is only a personal project, I've opted to keep the number of tests to a minimum. You can run the tests using the following command:
1npm test
No vulnerabilities found.
No security vulnerabilities found.