1.6.0 • Published 2 months ago

@nuskin/foundation-theme v1.6.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

@nuskin/foundation-themes

This repository houses a collection of Nuskin themes. Intended for utilization by developers across various teams, these themes serve as a standardized design system to ensure a consistent and cohesive visual identity throughout the Nuskin website.

Supports Dark Mode:

Enhance the user experience with a seamlessly integrated dark mode feature.

NuskinThemeProvider for Theme Change:

The repository includes a NuskinThemeProvider that simplifies the process of dynamically changing themes.

Tailwind CSS Utilities:

Utility CSS classes from Tailwind CSS included to provide a robust set of styling options.

Latest Release

Released Versions

Installation Guide

Clone the repository to your local machine

git clone git@code.tls.nuskin.io:ns-am/content-foundation/foundation-theme.git

Usage

The following example illustrates how to use this project

import { NextGenThemeProvider, forceForGoodTheme, FoundationTheme } from '@nuskin/foundation-theme';
import { NsButton } from '@nuskin/foundation-ui-components';

import Button from '@mui/material/Button';

export function App1(props) {
    const theme = useMemo(() => {
        if (props.theme === 'forceForGood') {
            return forceForGoodTheme;
        }
    }, props.theme);
    const { palette = {} } = theme || {};
    const colorVariables = Object.keys(palette) as FoundationTheme.PaletteColors[];
    return (
        <NextGenThemeProvider isSSR cacheKey="app" theme={theme}>
            {colorVariables?.map((color, index) => (
                <NsButton variant="contained" color={color} key={color + index}>
                  `Button ${index}`
                </NsButton>

            ))}
        </NextGenThemeProvider>
    );
}

Project Dependencies

Emotion Libraries

Material-UI

Utility Libraries

Testing

We use Jest for testing our project. Below are the available test scripts:

  • Run all tests and generate coverage report:**
    yarn test
  • Run tests for a specific pattern (e.g., accordion/*):
    yarn run test:pattern
  • Run only failed tests from the last test run:
    yarn run test:failed
  • Generate and view code coverage report:

    yarn run test:coverage
  • The yarn test script builds the project using Next.js before running Jest tests.

  • Feel free to customize the test patterns or add additional options as needed.

Coverage Report:

After running tests, open the index.html file in the coverage directory to view the coverage report.

Notes

1. To opt out of theme switching between light and dark mode, pass the darkModeEnabled prop with a false value.

2. The following example shows how to retrieve colors using ColorUtils.color

import { ColorUtils } from '@nuskin/foundation-theme';

const color = ColorUtils.color('primary', 'main')(validTheme);

3. The theme repository offers style exports through a Universal Module Definition (UMD) file.

4. Additionally, it provides convenient access to styling capabilities via the Styled and globalStyled features directly from the theme.

1.6.0-1216-v1.1

2 months ago

1.6.0

2 months ago

1.5.1

2 months ago

1.5.0

4 months ago

1.4.1

5 months ago

1.2.0

7 months ago

1.0.2

7 months ago

1.1.0

7 months ago

1.0.1

8 months ago

1.0.0

8 months ago

1.4.0

5 months ago

1.3.1

5 months ago

1.3.0-cx130-817.1

5 months ago

1.2.2

6 months ago

1.3.0

5 months ago

1.3.0-cx130-817.2

5 months ago

1.2.1

6 months ago

1.0.0-develop.5

10 months ago

1.4.0-cx130-817.1

5 months ago

1.0.0-develop.3

10 months ago

1.0.0-develop.4

10 months ago

1.4.0-cx130-1049.1

5 months ago

1.3.0-cx130-596.1

6 months ago

1.3.0-cx130-596.2

6 months ago

1.3.0-cx130-596.3

5 months ago

1.0.0-develop.2

11 months ago

1.0.0-develop.1

11 months ago

1.0.0-cft-33.7

1 year ago

1.0.0-cft-33.6

1 year ago

1.0.0-cft-33.9

1 year ago

1.0.0-cft-33.8

1 year ago

1.0.0-cft-33.10

1 year ago

1.0.0-cft-33.11

1 year ago

1.0.0-cft-33.12

1 year ago

1.0.0-cft-33.5

1 year ago

1.0.0-cft-33.4

1 year ago

1.0.0-cft-33.3

1 year ago

1.0.0-cft-33.2

1 year ago