-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add UI monorepo package #56
base: release
Are you sure you want to change the base?
Changes from all commits
f4ac43c
888e6a5
1a66116
e473640
caf7829
69e91b7
e251f55
47b4485
a3e5d72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,11 @@ | ||||||||||||||||||||||||
{ | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my standard prettier config that i use across all projects (also aligns with this project)
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Сможешь ли его вынести в корень проекта - отформатировав его весь после этого, чтобы я мог его активировать у себя и убрать этот? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i dont really understand what the problem is on your side... |
||||||||||||||||||||||||
"printWidth": 120, | ||||||||||||||||||||||||
"tabWidth": 2, | ||||||||||||||||||||||||
"bracketSpacing": true, | ||||||||||||||||||||||||
"bracketSameLine": false, | ||||||||||||||||||||||||
"singleQuote": true, | ||||||||||||||||||||||||
"trailingComma": "all", | ||||||||||||||||||||||||
"arrowParens": "always", | ||||||||||||||||||||||||
"semi": true, | ||||||||||||||||||||||||
"quoteProps": "consistent" | ||||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { StorybookConfig } from '@storybook/react-vite'; | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../src/**/*.stories.@(ts|tsx)', '../src/**/*.mdx'], | ||
addons: ['@storybook/addon-essentials', '@storybook/addon-interactions'], | ||
core: { | ||
disableTelemetry: true, | ||
disableWhatsNewNotifications: true, | ||
}, | ||
framework: { | ||
name: '@storybook/react-vite', | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: 'tag', | ||
}, | ||
}; | ||
|
||
export default config; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Preview } from '@storybook/react'; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
actions: { argTypesRegex: '^on[A-Z].*' }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "@prismarine-web-client/ui", | ||
"version": "1.0.0", | ||
"main": "./src/index.ts", | ||
"scripts": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add |
||
"storybook:start": "storybook dev -p 6006", | ||
"storybook:build": "storybook build", | ||
"------------------------------------------------------": "", | ||
"prettier:fix": "prettier --write './**/*.{ts,tsx}'", | ||
"prettier:check": "prettier --check './**/*.{ts,tsx}'" | ||
}, | ||
"peerDependencies": { | ||
"classnames": "^2.5.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why peer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Базовый проект уже имеет эту зависимость - при обновлении в базовом проекте, можем забыть обновить здесь, тогда будет установлено две зависимости одного пакета с разными версиями - возникнет дубль |
||
"react": "^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@storybook/addon-essentials": "^7.4.6", | ||
"@storybook/addon-interactions": "^7.4.6", | ||
"@storybook/addon-links": "^7.4.6", | ||
"@storybook/addon-onboarding": "^1.0.8", | ||
"@storybook/blocks": "^7.4.6", | ||
"@storybook/react": "^7.4.6", | ||
"@storybook/react-vite": "^7.4.6", | ||
"@storybook/testing-library": "^0.2.2", | ||
"@types/react-dom": "^18.2.14", | ||
"classnames": "^2.5.1", | ||
"prettier": "^3.2.1", | ||
"react-dom": "^18.2.0", | ||
"storybook": "^7.4.6", | ||
"vite": "^4.5.0" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.root { | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
|
||
font-family: minecraft, mojangles, monospace; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import classNames from 'classnames'; | ||
import { HTMLAttributes } from 'react'; | ||
|
||
import styles from './AppRoot.module.css'; | ||
|
||
export interface AppRootProps extends HTMLAttributes<HTMLDivElement> {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is better to use For the same reason, I think its better to not export these interfaces and in other files do something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad, i mean |
||
|
||
export const AppRoot = ({ className, ...restProps }: AppRootProps) => { | ||
return <div className={classNames(styles.root, className)} {...restProps} />; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { AppRoot, type AppRootProps } from './AppRoot'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import classNames from 'classnames'; | ||
import { AllHTMLAttributes } from 'react'; | ||
|
||
import { HasComponent, HasRootRef } from '../../types'; | ||
|
||
export interface RootComponentProps<T> extends AllHTMLAttributes<T>, HasRootRef<T>, HasComponent { | ||
baseClassName?: string | false; | ||
} | ||
|
||
export const RootComponent = <T,>({ | ||
Component = 'div', | ||
getRootRef, | ||
baseClassName, | ||
className, | ||
...restProps | ||
}: RootComponentProps<T>) => { | ||
return <Component ref={getRootRef} className={classNames(baseClassName, className)} {...restProps} />; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './RootComponent'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.root { | ||
font-size: var(--ui_font_size_text); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import classNames from 'classnames'; | ||
import { Typography, TypographyProps } from '../Typography'; | ||
|
||
import styles from './Text.module.css'; | ||
|
||
export type TextProps = TypographyProps; | ||
|
||
export const Text = ({ Component = 'span', className, ...restProps }: TextProps) => { | ||
return <Typography Component={Component} className={classNames(styles.root, className)} {...restProps} />; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Text, type TextProps } from './Text'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why add? not clear. half of the project uses it and the other doesn't.