npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tdcerhverv/mui-theme

v5.3.7

Published

Package containing theme for use with Material UI components.

Downloads

1,127

Readme

TDC Erhverv Material UI Theme

TDC Erhverv component styles for Material UI Components

The design specifications for components can be found on Figma.

The UX specifcations and use cases of the components can be found on ZeroHeight.

The styled components can be previewed on both Storybook and Chromatic

Setup

The package can be installed via NPM

npm i @tdcerhverv/mui-theme

Usage

This package is intendid to be used with Material-UI components and a ThemeProvider. With this wrapper you should be able to develop your application with the theme styling using Material-UI components out of the box.

Furthermore the <CssBaseline/> component should be included inside the <ThemeProvider/> before your app. For further information on <CssBaseline/>, please refer to Material-UI's documentation.

import { ThemeProvider } from '@mui/material/styles';
import TdcTheme from '@tdcerhverv/mui-theme';
import { CssBaseline } from '@mui/material';

export function App() {
    ReactDOM.render(
        <ThemeProvider theme={TdcTheme}>
            <CssBaseline />
            <App />
        </ThemeProvider>,
    );
}

Fonts

Pimarily the font used in the theme is "Mukta Mahee" and is included through the http://s.c.dk CDN.

In order to load fonts faster you should preload the fonts from the CDN.

<link rel="preload" href="//s.c.dk/fonts/mukta-mahee/mukta-mahee-latin-300-normal.woff2" as="font" crossorigin />
<link rel="preload" href="//s.c.dk/fonts/mukta-mahee/mukta-mahee-latin-500-normal.woff2" as="font" crossorigin />
<link rel="preload" href="//s.c.dk/fonts/mukta-mahee/mukta-mahee-latin-600-normal.woff2" as="font" crossorigin />

You will probably need the crossorigin attribute otherwise the browser will ignore the preload requested from a different domain.

The crossorigin attribute indicates whether the resource should be fetched with a CORS request as the font may come from a different domain. Without this attribute, the preloaded font is ignored by the browser. — https://web.dev/codelab-preload-web-fonts/#preloading-web-fonts

Variants

Some components offer custom variations of their styling, these are called Variants. An example of this is the Alert component, which has a variant called InlineAnnouncement that has a bottom border.

The base Alert component is created with the following:

<Alert severity="success" variant="standard">
    This is a message.
</Alert>

And the variant InlineAnnouncement uses a different class:

<Alert severity="info" variants="inline">
    This is a message.
</Alert>

Custom Variants

Custom variants are a way to create a new variant for any given componenet.

A custom variants are created in the following way:

Inside of the component file:

        variants: [
            {
                props: { variant: 'inline', severity: 'success' },
                style: {
                    padding: `4px 12px`,
                    backgroundColor: palette.success.contrastText,
                    borderBottom: `3px solid ${palette.success.dark}`,
                    ...shape,
                    '& .MuiAlert-icon': {
                        color: palette.success.dark,
                        '& > svg': {
                            width: 16,
                            height: 16,
                        },
                    },
                    '& .MuiAlert-message': {
                        color: palette.success.dark,
                        '& .MuiAlertTitle-root': {
                            ...typography.subtitle2,
                            marginBottom: 0,
                        },
                        '& .MuiLink-root': {
                            color: palette.success.dark,
                        },
                    },
                    '& .MuiAlert-action': {
                        color: palette.success.dark,
                    },
                },
            },
        ],

The variant prop will be the name of this new variant.

The severity prop in this case references a color from our palette.ts file, so you could have a variant that looks entirely based on the color given to it.

That would however require you to create another object in the variants array show in the example above.

In the global.d.ts file:

declare module '@mui/material/Alert' {
    interface AlertPropsVariantOverrides {
        inline: true;
    }
}

Declare the module inside of declare global.

Atomic Components

As of version 5.0.0 Atomic Components has been deleted.

Contributing

Please make sure that any and all changes suggested fulfill the following:

  • Styling on a specific material ui provided component
  • Suggested change has an agreed upon figma/zeroheight design
  • Change has a story if at all possible (some extremely small cases do not warrent a story (for example, FormLabel)

This package uses semantic pull-requests. PR titles should begin with the appropriate prefix, e.g. fix: or feat:. Branches should also follow this structure and be prefixed with fix/, feat/, or other relevant semantic label.

This repo uses the TDC Shared Components Jira board* for issue tracking. It is recommended to use the Jira Github integration for creating branches and pull requests. If you can't use this integration, then please refer to the Jira issue in the branch and PR name. For example the branch feat/SCP-123-my-feature should have a pull request titled feat: SCP-123 My Feature.

* Currently the Jira Github intergration does not apply Pull Request description templates. If using this integration, please add a description to your PR following the provided PR Template


You need two approvals on a PR, and both @nuuday/mdc-business, @nuuday/internet and Business Open Pages Review Group (https://github.com/orgs/nuuday/teams/business-open-pages-review-group/members) should be added as reviwers

In addition to regular Code Review, this Repo uses Chromatic for visual review. Chromatic will run a UI Test and UI Review on your PR. The UI Test will show you snapshots ofyour changes, and require you to approve or reject the changes.

When you are content with the changes in both UI Tests and Code Review, then you should open the UI Review, and assign a Designer as a reviewer in chromatic. Note that all assigned reviewers in chromatic must approve before the PR can be merged.

Coding rules

Font sizes should be defined with rem values using the pxToRem function. Spacing such as padding, margin etc. should be defined with fixed pixels values. You should avoid using the spacing function to have consistency in the code.