0.19.0 • Published 28 days ago

@ama-pt/agora-design-system v0.19.0

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
28 days ago

Ágora Design System

Vision


Goal


Core technologies

Useful Links

Installation

> npm install @ama-pt/agora-design-system

Tailwind configuration

In order to reduce bundle size, we needed do strip some classes from the bundle. As result, some of the tailwind classes may not be available out of the box. To have access to all tailwind AgoraDS themed classes you have to do some additional steps.

  • Install and initialize tailwindcss
> npm install -D tailwindcss postcss autoprefixer
> npx tailwindcss init -p
  • Add the @tailwind directives for each of Tailwind’s layers to your main CSS file
@tailwind base;
@tailwind components;
@tailwind utilities;
  • Open tailwind.config.ts, set AgoraDS configs, and set the content config with the desired glob to allow tailwind to generate all of the corresponding CSS needed for your project:
import { AgoraTailwindConfig } from '@ama-pt/agora-design-system';
import type { Config } from 'tailwindcss';

const TailwindConfig: Config = {
  content: ['src/**/*.{ts,tsx}'],
  theme: AgoraTailwindConfig.theme,
  plugins: AgoraTailwindConfig.plugins,
  safelist: AgoraTailwindConfig.safelist,
  corePlugins: {
    preflight: false
  }
};

export default TailwindConfig;
  • import the css style file that exists in node_modules folder into your layout.tsx file (if working with NextJS) or index.tsx (if working with React only)
//  typescript import
import '@ama-pt/agora-design-system/dist/index.css';
//  or equivalent for javascript imports
  • Run and test the app...

Overriding Tailwind configuration

To override any tailwind config you need to update the tailwind.config.ts file as explained in the following example:

import { AgoraTailwindConfig } from '@ama-pt/agora-design-system';
import type { Config } from 'tailwindcss';

const TailwindConfig: Config = {
  content: ['src/**/*.tsx'],
  theme: {
    ...AgoraTailwindConfig.theme,
    colors: {
      ...AgoraTailwindConfig.theme.colors,
      primary: {
        50: '#FFF000',
        100: '#FFF000',
        200: '#FFF000',
        300: '#FFF000',
        400: '#FFF000',
        500: '#FFF000',
        600: '#FFF000',
        700: '#FFF000',
        800: '#FFF000',
        900: '#FFF000'
      }
    }
  },
  plugins: AgoraTailwindConfig.plugins,
  safelist: AgoraTailwindConfig.safelist,
  corePlugins: { preflight: false }
};

export default TailwindConfig;

With this example we are transforming all primary color shades into yellow.

corePlugins - is used to disable de tailwind resets already done by the AgoraDS library.

0.19.0

28 days ago

0.18.0

1 month ago

0.17.0

2 months ago

0.16.0

2 months ago

0.15.0

3 months ago

0.14.0

3 months ago

0.13.1

3 months ago

0.13.0

3 months ago

0.12.0

4 months ago

0.11.5

5 months ago

0.11.3

5 months ago

0.11.4

5 months ago

0.11.2

5 months ago

0.11.0

5 months ago

0.11.1

5 months ago

0.10.1

6 months ago

0.10.0

6 months ago

0.9.0

6 months ago

0.8.1

7 months ago

0.3.0

9 months ago

0.8.0

7 months ago

0.5.0

8 months ago

0.2.3

9 months ago

0.4.0

8 months ago

0.3.1

9 months ago

0.2.2

9 months ago

0.7.0

7 months ago

0.6.1

8 months ago

0.6.0

8 months ago

0.2.1

11 months ago

0.2.0

11 months ago

0.1.16

12 months ago

0.1.15

1 year ago

0.1.14

1 year ago

0.1.12

1 year ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago