Skip to content

Commit

Permalink
more shadcn, tailwind, and storybook impl
Browse files Browse the repository at this point in the history
  • Loading branch information
tylervick committed Jan 23, 2024
1 parent 09f1c48 commit 0270d1e
Show file tree
Hide file tree
Showing 40 changed files with 18,912 additions and 1,084 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'plugin:storybook/recommended',
],
parser: '@typescript-eslint/parser',
parserOptions: {
Expand Down
15 changes: 7 additions & 8 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
module.exports = {
...require('eslint-config-mantine/.prettierrc.js'),
printWidth: 100,
singleQuote: true,
trailingComma: 'all',
jsxSingleQuote: true,
tabWidth: 2,
plugins: ['prettier-plugin-organize-imports'],
}
printWidth: 100,
singleQuote: true,
trailingComma: 'all',
jsxSingleQuote: true,
tabWidth: 2,
plugins: ['prettier-plugin-organize-imports'],
};
8 changes: 7 additions & 1 deletion .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ import type { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.story.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-essentials', 'storybook-dark-mode'],
addons: ['@storybook/addon-essentials', 'storybook-dark-mode', 'storybook-css-modules-preset'],
framework: {
name: '@storybook/react-vite',
options: {},
},
typescript: {
reactDocgen: 'react-docgen',
},
docs: {
autodocs: true,
},
};

export default config;
19 changes: 11 additions & 8 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { MantineProvider, useMantineColorScheme } from '@mantine/core';
import '@mantine/core/styles.css';
import '@/globals.css';
import { addons } from '@storybook/preview-api';
import React, { useEffect } from 'react';
import { DARK_MODE_EVENT_NAME } from 'storybook-dark-mode';
import { theme } from '../src/theme';
import { ThemeProvider, useTheme } from '../src/components/theme-provider';

const channel = addons.getChannel();

function ColorSchemeWrapper({ children }: { children: React.ReactNode }) {
const { setColorScheme } = useMantineColorScheme();
const handleColorScheme = (value: boolean) => setColorScheme(value ? 'dark' : 'light');
function Wrapper({ children }: { children: React.ReactNode }) {
const { setTheme } = useTheme();
const handleColorScheme = (value: boolean) => setTheme(value ? 'dark' : 'light');

useEffect(() => {
channel.on(DARK_MODE_EVENT_NAME, handleColorScheme);
Expand All @@ -20,6 +19,10 @@ function ColorSchemeWrapper({ children }: { children: React.ReactNode }) {
}

export const decorators = [
(renderStory: any) => <ColorSchemeWrapper>{renderStory()}</ColorSchemeWrapper>,
(renderStory: any) => <MantineProvider theme={theme}>{renderStory()}</MantineProvider>,
(renderStory: any) => (
<ThemeProvider defaultTheme='dark' storageKey='vite-ui-theme'>
<Wrapper>{renderStory()}</Wrapper>
</ThemeProvider>
),
// (renderStory: any) => <MantineProvider theme={theme}>{renderStory()}</MantineProvider>,
];
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"cSpell.words": ["fastify", "mantine", "stylelint", "typecheck"],
"cSpell.words": ["fastify", "mantine", "protoc", "stylelint", "typecheck"],
"prettier.prettierPath": "./node_modules/prettier/index.cjs",
"editor.formatOnSave": true
"editor.formatOnSave": true,
"editor.tabSize": 2
}
893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.0.1.cjs

This file was deleted.

3 changes: 0 additions & 3 deletions .yarnrc.yml

This file was deleted.

5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# Mantine Vite template
# grpc-forms

## Features

This template comes with the following features:

- [PostCSS](https://postcss.org/) with [mantine-postcss-preset](https://mantine.dev/styles/postcss-preset)
- [TypeScript](https://www.typescriptlang.org/)
- [Storybook](https://storybook.js.org/)
- [Vitest](https://vitest.dev/) setup with [React Testing Library](https://testing-library.com/docs/react-testing-library/intro)
- ESLint setup with [eslint-config-mantine](https://github.com/mantinedev/eslint-config-mantine)

## npm scripts

Expand Down
Binary file modified bun.lockb
Binary file not shown.
Loading

0 comments on commit 0270d1e

Please sign in to comment.