@mudita/space-design-system v1.3.1
Mudita Space Design System
A React based library for components and predefined styles used in Mudita products like Mudita Cloud.
All the currently available components can be seen on our Storybook. It's a kind of visual guide and documentation.
Usage
- Install 
@mudita/space-design-systempackage:npm install --save @mudita/space-design-system - Install additional dependencies:
reactin version 17 or highernpm install --save reactstyled-componentsin version 5 or highernpm install --save styled-components
 Use the
ThemeProviderfrom the package:import { MuditaThemeProvider } from "@mudita/space-design-system" ReactDOM.render( <MuditaThemeProvider> <App /> </MuditaThemeProvider>, document.getElementById("root") )Now you can use the library freely:
import { Button } from "@mudita/space-design-system" const SomeComponent = () => ( <Button> Click me! </Button> )CJS, ESModules, and UMD module formats are supported.
Fonts
The basic Mudita's font is
Factobut it's not open sourced, so we can't provide it to you. Instead, there is a very similar font used as a fallback -Arial. However, you can still attach aFactofont to your project if you own it.Then, you just need to import the CSS file in your main app's component:
// index.tsx import "./path/to/font/style.css" ReactDOM.render(...)The
Factofont has bigger priority, so no additional actions are required. It will be immediately displayed instead of other fonts.
Development
Installation
Install dependencies:
npm installInstall
Factofont (optional):- add 
FONTS_DIRECTORY_URLandGITHUB_ACCESS_TOKENenvironment variables to your repo with given font - run font downloading script:
npm run fonts:download 
Note: Please make sure you entered
FONTS_DIRECTORY_URLin a proper format (refer to troubleshooting section).- add 
 
Local testing
Make appropriate changes.
Increase package version manually (only in
package.jsonfile).Build the package:
npm run buildPack the library into a
tarpackage:npm packIn your project that consumes this library, instead of version number in
dependenciesfor@mudita/space-design-systempackage put the path to the already generated.tarfile:"@mudita/space-design-system": "file:../space-design-system/mudita-space-design-system-X.Y.Z.tgz",Reinstall the updated package:
npm install @mudita/space-design-systemDepending on your project's setup, rebuild it or reload the page to apply changes.
More information and different methods of developing and testing packages locally can be found in this awesome article.
Release flow
Make appropriate changes.
Rebuild the package:
npm run buildIncrease package version:
npm version <version>Note: For version
0.0.31the command will benpm version 0.0.31. We are using semantic versioning.Publish the package to the NPM registry:
npm publishCommit and push changes (with updated version) to the repo:
git add . git commit -m "Updated to version x.y.z" git push -u origin master
Troubleshooting
Authentication error while downloading fonts (
npm run fonts:download).Solution: Please make sure you have the following envs added in the
.envfile:GITHUB_ACCESS_TOKEN= FONTS_DIRECTORY_URL=https://raw.githubusercontent.com/<username | organisation name>/<repo name>/<branch name>/<path to directory with font files>Note: The token should have granted at least
reposcope and be able to access the repository defined inFONTS_DIRECTORY_URLenv.
Bundle analysis
Calculates the real cost of your library using size-limit with npm run size and visualize it with npm run analyze.