Skip to content

Commit c957eb9

Browse files
(BA-1077) baseapp modularization
1 parent 4de8a61 commit c957eb9

File tree

29 files changed

+3622
-2173
lines changed

29 files changed

+3622
-2173
lines changed

.changeset/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://unpkg.com/@changesets/config@2.0.0/schema.json",
33
"changelog": "@changesets/cli/changelog",
4-
"commit": true,
4+
"commit": false,
55
"fixed": [],
66
"linked": [],
77
"access": "restricted",

README.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,15 @@ export default function Docs() {
4040

4141
## Apps and Packages
4242

43-
- `docs`: a app to document some packages's features
44-
- `core`: core of utilities like `auth hooks`, `permisisons system` and `util functions`
45-
- `config`: reusable configurations for `eslint`, `prettier` and `jest`
46-
- `tsconfig`: reusable typescript configs
43+
- `docs`: an app to document some packages's features
44+
- `authentication`: includes authentication modules such as `login`, `signup`, `reset password`, `multifactor authentication` and more.
45+
- `core`: core of utilities like `auth hooks`, `permisisons system` and `util functions`.
46+
- `config`: includes reusable configurations for `eslint`, `prettier` and `jest`.
47+
- `design-system-mui`: defines our `design system configuration `(e.g. color pallete, typography, spacings, etc). It also shares reusable `components` that make up the design system as a whole.
48+
- `provider`: includes provider of different kinds that have "use client" directive on top.
49+
- `test`: extends `React Testing Library` features and export some util functions, mocks and test configurations.
50+
- `tsconfig`: reusable `typescript configs`.
51+
- `utils`: includes `constants`, `functions`, `hooks` and `types` that are generic enough to be reused between apps and packages.
4752

4853
## NVM
4954

apps/docs/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
"@emotion/react": "^11.10.0",
1515
"@emotion/styled": "^11.10.0",
1616
"@mui/material": "^5.10.0",
17+
"@tanstack/react-query": "^4.29.12",
1718
"axios-mock-adapter": "^1.20.0",
1819
"next": "^12.2.4",
1920
"react": "^18.2.0",
20-
"react-dom": "^18.2.0",
21-
"react-query": "^3.34.8"
21+
"react-dom": "^18.2.0"
2222
},
2323
"devDependencies": {
2424
"@baseapp-frontend/config": "*",

apps/docs/pages/_app.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { QueryClient, QueryClientProvider } from 'react-query'
1+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
22

33
export default function MyApp({ Component, pageProps }: { Component: any; pageProps: object }) {
44
const client = new QueryClient()

apps/docs/pages/components/index.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
import { useState } from 'react'
2+
13
import {
24
ButtonWithLoading,
3-
PasswordField,
4-
ImageUploader,
55
CheckboxField,
6+
ImageUploader,
7+
PasswordField,
68
} from '@baseapp-frontend/design-system-mui'
9+
710
import { Divider, useTheme } from '@mui/material'
8-
import { useState } from 'react'
911

1012
export default function Docs() {
1113
const [images, setImages] = useState([])
@@ -21,7 +23,7 @@ export default function Docs() {
2123
button
2224
</ButtonWithLoading>
2325

24-
<ButtonWithLoading variant="contained" loading>
26+
<ButtonWithLoading variant="contained" isLoading>
2527
button
2628
</ButtonWithLoading>
2729
</div>

apps/storybook-app/components/Button/stories.tsx

-50
This file was deleted.

apps/storybook-app/components/Checkbox/index.tsx

-3
This file was deleted.
File renamed without changes.
File renamed without changes.

apps/storybook-app/.storybook/main.ts apps/storybook/.storybook/main.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import type { StorybookConfig } from '@storybook/nextjs'
22

33
const config: StorybookConfig = {
4-
stories: [
5-
'../components/**/stories.@(js|jsx|ts|tsx)',
6-
],
4+
stories: ['../components/**/stories.@(js|jsx|ts|tsx)'],
75
addons: [
86
'@storybook/addon-links',
97
'@storybook/addon-essentials',
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import type { Meta, StoryObj } from '@storybook/react'
2+
3+
import { Button } from '.'
4+
5+
const meta: Meta<typeof Button> = {
6+
title: 'Button',
7+
component: Button,
8+
}
9+
export default meta
10+
11+
type Story = StoryObj<typeof Button>
12+
13+
export const ButtonPrimary: Story = {
14+
args: {
15+
children: 'My button',
16+
variant: 'contained',
17+
},
18+
}
19+
20+
export const ButtonSecondary: Story = {
21+
args: {
22+
children: 'My button',
23+
variant: 'contained',
24+
color: 'secondary',
25+
},
26+
}
27+
28+
export const ButtonFullwidth: Story = {
29+
args: {
30+
children: 'My button',
31+
fullWidth: true,
32+
variant: 'outlined',
33+
},
34+
}
35+
36+
export const ButtonDisabled: Story = {
37+
args: {
38+
children: 'My button',
39+
variant: 'contained',
40+
disabled: true,
41+
},
42+
}
43+
44+
export const ButtonLoading: Story = {
45+
args: {
46+
children: 'My button',
47+
loading: true,
48+
variant: 'outlined',
49+
},
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { CheckboxField, ICheckboxFieldProps } from '@baseapp-frontend/design-system-mui'
2+
3+
export const Checkbox = ({ ...props }: ICheckboxFieldProps) => <CheckboxField {...props} />

apps/storybook-app/components/PasswordField/stories.tsx apps/storybook/components/PasswordField/stories.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Meta, StoryObj } from '@storybook/react'
2-
import { Password } from '.'
32

3+
import { Password } from '.'
44

55
const meta: Meta<typeof Password> = {
66
title: 'Password',
File renamed without changes.
File renamed without changes.

apps/storybook-app/package.json apps/storybook/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "storybook-app",
2+
"name": "storybook",
33
"version": "1.0.0",
44
"main": "index.js",
55
"license": "MIT",
File renamed without changes.
File renamed without changes.
File renamed without changes.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "baseapp-frontend",
3+
"description": "A modularized package system for TSL's frontend baseapp.",
34
"version": "0.0.0",
45
"private": true,
56
"workspaces": [
@@ -21,11 +22,10 @@
2122
"dependencies": {},
2223
"devDependencies": {
2324
"@changesets/cli": "^2.23.0",
24-
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
25-
"eslint": "^8.29.0",
25+
"eslint": "^8.42.0",
2626
"husky": "^8.0.0",
2727
"lint-staged": "^13.0.2",
28-
"prettier": "latest",
28+
"prettier": "^2.8.8",
2929
"turbo": "latest"
3030
},
3131
"engines": {

0 commit comments

Comments
 (0)