Skip to content

Commit

Permalink
adjust component comments
Browse files Browse the repository at this point in the history
  • Loading branch information
YieldRay committed Apr 25, 2024
1 parent 5f82958 commit f6058a1
Show file tree
Hide file tree
Showing 14 changed files with 30 additions and 21 deletions.
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,35 @@
"react-dom": ">=18"
},
"devDependencies": {
"@floating-ui/react": "^0.26.10",
"@floating-ui/react": "^0.26.12",
"@ianvs/prettier-plugin-sort-imports": "^4.2.1",
"@material/material-color-utilities": "^0.2.7",
"@mdi/js": "^7.4.47",
"@mdi/react": "^1.6.1",
"@storybook/addon-essentials": "^8.0.5",
"@storybook/addon-interactions": "^8.0.5",
"@storybook/addon-links": "^8.0.5",
"@storybook/blocks": "^8.0.5",
"@storybook/react": "^8.0.5",
"@storybook/react-vite": "^8.0.5",
"@types/react": "^18.2.74",
"@types/react-dom": "^18.2.23",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"@storybook/addon-essentials": "^8.0.9",
"@storybook/addon-interactions": "^8.0.9",
"@storybook/addon-links": "^8.0.9",
"@storybook/blocks": "^8.0.9",
"@storybook/react": "^8.0.9",
"@storybook/react-vite": "^8.0.9",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"@vitejs/plugin-react": "^4.2.1",
"chromatic": "^11.3.0",
"clsx": "^2.1.0",
"clsx": "^2.1.1",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"eslint-plugin-storybook": "^0.8.0",
"glob": "^10.3.12",
"prettier": "^3.2.5",
"sass": "^1.72.0",
"storybook": "^8.0.5",
"sass": "^1.75.0",
"storybook": "^8.0.9",
"styled-jsx": "^5.1.2",
"typescript": "^5.4.3",
"vite": "^5.2.7"
"typescript": "^5.4.5",
"vite": "^5.2.10"
},
"publishConfig": {
"registry": "https://registry.npmjs.org"
Expand Down
1 change: 1 addition & 0 deletions src/components/app-bar/BottomAppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ExtendProps } from '@/utils/type'

/**
* `<BottomAppBar>` has fixed style `height: 80px`
*
* @specs https://m3.material.io/components/bottom-app-bar/specs
*/
export const BottomAppBar = forwardRef<
Expand Down
1 change: 0 additions & 1 deletion src/components/app-bar/TopAppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { mergeStyles } from '@/utils/style'
import { ExtendProps } from '@/utils/type'

/**
*
* @specs https://m3.material.io/components/top-app-bar/specs
*/
export const TopAppBar = forwardRef<
Expand Down
1 change: 1 addition & 0 deletions src/components/card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ExtendProps, TagNameString } from '@/utils/type'

/**
* You can set the `disabled` property to disable ripple
*
* @specs https://m3.material.io/components/cards/specs
*/
export const Card = forwardRef<
Expand Down
2 changes: 1 addition & 1 deletion src/components/carousel/Carousel.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const Default: Story = {
args: {
items: new Array(6).fill(0).map((_, i) => ({
value: (
<img src={`https://placekitten.com/200/${(i + 2) * 50}`}></img>
<img src={`https://picsum.photos/200/300?random=${i}`}></img>
),
label: `Cat ${i + 1}`,
})),
Expand Down
6 changes: 3 additions & 3 deletions src/components/carousel/Carousel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ interface ItemWithFlex extends Item {

/**
* [warn]: Incomplete implementation, and only three visible items is implemented,
* make sure the array length is multiple of 3, or it will throw error
* make sure the array length is multiple of 3
*
* @specs https://m3.material.io/components/carousel/specs
*/
export const Carousel = forwardRef<
Expand All @@ -35,8 +36,7 @@ export const Carousel = forwardRef<
{ items: initItems, height, className, style, ...props },
ref,
) {
if (initItems.length % 3 !== 0)
throw new Error('the item array length must be a multiple of 3')
initItems.slice(0, initItems.length - (initItems.length % 3)) // make sure the array length is multiple of 3
const [items, setItems] = useState(initFlex(initItems))
const containerRef = useRef<HTMLDivElement>(null)
useImperativeHandle(ref, () => containerRef.current!)
Expand Down
1 change: 1 addition & 0 deletions src/components/checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { ExtendProps } from '@/utils/type'
/**
* According to the official implementation, the ripple effect should not occupy space.
* Therefore, if the parent container has `overflow: hidden`, make sure that there is enough area to show the ripple effect.
*
* @specs https://m3.material.io/components/checkbox/specs
*/
export const Checkbox = forwardRef<
Expand Down
1 change: 1 addition & 0 deletions src/components/divider/Divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ExtendProps } from '@/utils/type'

/**
* The divider has margin included by default, you can remove it by adding `style={{margin:"0"}}`
*
* @specs https://m3.material.io/components/divider/specs
*/
export const Divider = forwardRef<
Expand Down
1 change: 1 addition & 0 deletions src/components/menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { ExtendProps } from '@/utils/type'

/**
* The `<Menu>` container, will contain `<MenuItem>` and `<Divider>` components
*
* @specs https://m3.material.io/components/menus/specs
*/
export const Menu = forwardRef<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ExtendProps } from '@/utils/type'
/**
* [notice]: This component has default `min-width: 5rem` and `width: 100%` for convenience.
* You can manually set style property to override it if needed.
*
* @specs https://m3.material.io/components/progress-indicators/specs#efada034-defe-401e-803a-e6ea2833a396
*/
export const LinearProgressIndicator = forwardRef<
Expand Down
1 change: 1 addition & 0 deletions src/components/radio-button/RadioButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ExtendProps } from '@/utils/type'
/**
* According to the official implementation, the ripple effect should not occupy space.
* Therefore, if the parent container has `overflow: hidden`, make sure that there is enough area to show the ripple effect.
*
* @specs https://m3.material.io/components/radio-button/specs
*/
export const RadioButton = forwardRef<
Expand Down
1 change: 1 addition & 0 deletions src/components/sheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type BottomSheetHandle = ReturnType<typeof attachDragEvent>
*
* This component use ref to control show and hide,
* you can call `ref.current.show()` to show and `ref.current.hide()` to hide
*
* @specs https://m3.material.io/components/bottom-sheets/specs
*/
export const BottomSheet = forwardRef<
Expand Down
1 change: 1 addition & 0 deletions src/components/slider/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { ExtendProps } from '@/utils/type'
* An slider component, note that you should set width or height (use `style` property) for this component!
*
* TODO: Two handles is not implemented yet!
*
* @specs https://m3.material.io/components/sliders/specs
*/
export const Slider = forwardRef<
Expand Down
1 change: 1 addition & 0 deletions src/components/tooltip/RichTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ExtendProps } from '@/utils/type'

/**
* [tips]: You may consider manually add `<br />`
*
* @specs https://m3.material.io/components/tooltips/specs
*/
export const RichTooltip = forwardRef<
Expand Down

0 comments on commit f6058a1

Please sign in to comment.