1.18.0 • Published 2 months ago

@makesenseorg/design-system v1.18.0

Weekly downloads
77
License
MIT
Repository
github
Last release
2 months ago

Makesense design system

NPM Netlify Status

The makesense design system is build to make makesense design guidelines and Vue component available accross our multiple web applications.

Living styleguide demo: https://makesense-design-system.netlify.com

Table of content

  1. Use in a Vue app
    1. Install dependency
    2. Import in the app
    3. Change the theme colors
    4. Import the styles and variables
    5. Usage
  2. Use in a Nuxt app
    1. Add as a dependency
    2. Create a plugin
    3. Change the theme colors on client side
    4. Import the styles and variables
    5. Usage
  3. Contributing
    1. Developing
    2. Testing
    3. Building
    4. Publishing

Use in a Vue app

1. Install dependency

npm i @makesenseorg/design-system

2. Import in the app

Import the design system in the app entry file (usually index.js or main.js)

import DesignSystem from '@makesenseorg/design-system'
import '@makesenseorg/design-system/dist/system.css'

Vue.use(DesignSystem);
...

3. Change the theme colors

Just below, load the app theme, to get all the colors related to your app. The theme needs to exist in the design system. (list of available themes in ./src/tokens/themes) The default name is base.

...
Vue.prototype.$loadTheme('base')

You can also change the theme using this.$loadTheme(theme_name) inside a view or a component.

4. Import the styles and variables

In order to have access to the design system variables and mixins, you need to import the shared.scss file. Note: You might need to run npm install node-sass@4.14.1 sass-loader@7.1.0

// globally inside vue.config.js
module.exports = {
  css: {
    loaderOptions: {
      sass: {
        data: `@import "@makesenseorg/design-system/dist/shared.scss";`,
      },
    },
  },
};

You're done! You can now use the components, mixins, scss variables.

5. Usage

In your App or in your app components, use the design system components like so :

<template>
    <div class="my-app">
        <mks-heading tag="h1">Hello world !</mks-heading>
    </div>
<template/>

<script>
import MksHeading from "@makesenseorg/design-system/dist/components/Heading.vue";

export default {
  name: "App",
  components: { MksHeading }
}
</script>

<style lang="scss">
.my-app {
  background: $color-primary;
}
</style>

Use in a Nuxt app

1. Add as a dependency

npm i @makesenseorg/design-system

2. Create a plugin

Add the plugin in nuxt.config.js.

plugins: ["~/plugins/design-system"],

Create the file design-system.js in plugins folder.

import Vue from "vue";
import DesignSystem from "@makesenseorg/design-system";

Vue.use(DesignSystem);
...

3. Change the theme colors

In order to change the theme color, you can use the function loadTheme, in plugins/design-system.js. The theme needs to exist in the design system. (list of available themes in ./src/tokens/themes) The default name is base.

...
if (process.client) {
  Vue.prototype.$loadTheme('jobs')
}

You can also change the theme using this.$loadTheme(theme_name) inside a view or a component.

⚠️ Warning ⚠️ It is important to only use loadTheme on the client side, as it would throw a document is not defined error on the server side.

4. Import the global CSS styles

In order to have access to the design system variables and mixins, you need to import the shared.scss file either locally in each component, or once globally in the app. The system.css file is a global file providing reset classes, fonts, and basic styling. The base.css and jobs.css register the design tokens as CSS variables. It is important to load them here to prevent a jump on first client load.

Note: You might need to run npm install node-sass@4.14.1 sass-loader@7.1.0

1. Install style-ressources

In order to load the styles globally, you need to install style-resources module

npm install --save-dev @nuxtjs/style-resources

2. Update nuxt.config.js

In nuxt.config.js, register the module and add the style files

css: [
    "@makesenseorg/design-system/dist/system.css",
    "@makesenseorg/design-system/src/system/tokens/generated/themes/base.css",
    // you need to specify your theme here to make sure it's loaded on server side
    "@makesenseorg/design-system/src/system/tokens/generated/themes/jobs.css"
  ],
modules: [
    '@nuxtjs/style-resources',
],
styleResources: {
    scss: [
      "@makesenseorg/design-system/dist/shared.scss",
    ],
},

You're done! You can now use the components, mixins, scss variables.

5. Usage

In your App or in your app components, use the design system components like so : You can use atoms directly without importing them. However for layouts and molecules, you need to manually import and register the component

<template>
    <div class="my-app">
        <!-- example with an atom -->
        <mks-heading tag="h1">Hello world !</mks-heading>
        <!-- example with a molecule -->
        <mks-site-footer>Made by makesense</mks-site-footer>
    </div>
<template/>

<script>
import MksSiteFooter from "@makesenseorg/design-system/dist/components/SiteFooter.vue";

export default {
  name: "App",
  components: { MksSiteFooter }
}
</script>

<style lang="scss">
.my-app {
  background: $color-primary;
}
</style>

Contributing

npm install

1. Developing

Compiles and hot-reloads living styleguide

npm run dev

2. Testing new components in a live playground

Compiles design system and uses it in a nuxt app. Before publishing new components, please test them in this playground app.

The first time you use the playground, run :

npm run install-playground

When you want to test a component in the playground, run :

npm run playground

Note: the command takes a while because it needs to build the system first in order to inject it as a dependency in the playground.

3. Building

Living styleguide

Compiles living styleguide to ./docs

npm run build

Library

Compiles design system as a library to ./dist

npm run build:system

4. Helper

Serve living styleguide locally

for example to develop on another application with a newer version of the styleguide

npm run serve

Lints and fixes files

npm run lint

5. Publishing

The repo is automatically publish when the version is updated and pushed to master.

Semantic versioning rules

Code statusStageRuleExample version
First releaseNew productStart with 1.0.01.0.0
Backward compatible bug fixesPatch releaseIncrement the third digit1.0.1
Backward compatible new featuresMinor releaseIncrement the middle digit and reset last digit to zero1.1.0
Changes that break backward compatibilityMajor releaseIncrement the first digit and reset middle and last digits to zero2.0.0

Thanks

Thanks to CION design system for providing the design system boilerplate.

License

MIT License - Copyright (c) Makesense

1.18.0

2 months ago

1.17.15

3 months ago

1.17.13-next.1

3 months ago

1.17.13-next.0

3 months ago

1.17.14

3 months ago

1.17.11

7 months ago

1.17.10

8 months ago

1.17.12-next.0

6 months ago

1.17.12-next.1

6 months ago

1.17.12-next.2

5 months ago

1.17.10-next.1

8 months ago

1.17.10-next.2

7 months ago

1.17.9-next.8

8 months ago

1.17.9-next.9

8 months ago

1.17.11-next.0

7 months ago

1.17.9-next.6

10 months ago

1.17.9-next.7

8 months ago

1.17.9-next.5

10 months ago

1.17.9-next

11 months ago

1.17.9-next.4

10 months ago

1.17.9-next.2

11 months ago

1.17.9-next.3

11 months ago

1.17.9

12 months ago

1.17.2

1 year ago

1.17.1

1 year ago

1.17.0

1 year ago

1.17.6

1 year ago

1.17.5

1 year ago

1.17.4

1 year ago

1.17.3

1 year ago

1.17.8

1 year ago

1.17.7

1 year ago

1.16.7

1 year ago

1.16.6

1 year ago

1.16.5

1 year ago

1.16.4

1 year ago

1.16.3

2 years ago

1.16.2

2 years ago

1.16.1

2 years ago

1.16.0

2 years ago

1.15.0

2 years ago

1.15.3

2 years ago

1.15.2

2 years ago

1.15.1

2 years ago

1.14.1

2 years ago

1.14.0

2 years ago

1.13.4

2 years ago

1.13.3

2 years ago

1.13.2

2 years ago

1.13.1

2 years ago

1.13.0

2 years ago

1.7.21

2 years ago

1.11.4

2 years ago

1.11.3

2 years ago

1.11.2

2 years ago

1.11.1

2 years ago

1.10.1

2 years ago

1.12.2

2 years ago

1.12.1

2 years ago

1.12.0

2 years ago

1.11.0

2 years ago

1.10.0

3 years ago

1.9.1

3 years ago

1.9.0

3 years ago

1.8.0

3 years ago

1.7.16

3 years ago

1.7.17

3 years ago

1.7.19

3 years ago

1.7.20

3 years ago

1.7.14

3 years ago

1.7.15

3 years ago

1.7.10

3 years ago

1.7.11

3 years ago

1.7.12

3 years ago

1.7.9

3 years ago

1.7.8

3 years ago

1.7.7

3 years ago

1.7.6

3 years ago

1.7.5

3 years ago

1.7.4

3 years ago

1.7.3

3 years ago

1.7.2

3 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.2

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.3

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.0

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.3

3 years ago

1.1.1

3 years ago

1.1.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.3.2

3 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.50

4 years ago

0.1.49

4 years ago

0.1.47

4 years ago

0.1.48

4 years ago

0.1.45

4 years ago

0.1.46

4 years ago

0.1.43

4 years ago

0.1.42

4 years ago

0.1.41

4 years ago

0.1.40

4 years ago

0.1.39

4 years ago

0.1.38

4 years ago

0.1.37

4 years ago

0.1.36

4 years ago

0.1.35

4 years ago

0.1.33

4 years ago

0.1.34

4 years ago

0.1.30

4 years ago

0.1.31

4 years ago

0.1.32

4 years ago

0.1.27

4 years ago

0.1.28

4 years ago

0.1.29

4 years ago

0.1.25

4 years ago

0.1.26

4 years ago

0.1.24

4 years ago

0.1.23

4 years ago

0.1.21

4 years ago

0.1.22

4 years ago

0.1.20

4 years ago

0.1.19

4 years ago

0.1.16

4 years ago

0.1.17

4 years ago

0.1.18

4 years ago

0.1.15

4 years ago

0.1.13

4 years ago

0.1.14

4 years ago

0.1.12

4 years ago

0.1.10

4 years ago

0.1.11

4 years ago

0.1.8

4 years ago

0.1.9

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago