Skip to content

Commit 2277fbf

Browse files
committed
export components wityh types
1 parent 203b74e commit 2277fbf

File tree

11 files changed

+107
-71
lines changed

11 files changed

+107
-71
lines changed

web/common/src/components/MessageContainer/MessageContainer.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Meta, StoryObj } from '@storybook/react-vite'
2-
import MessageContainer from './MessageContainer'
2+
import { MessageContainer } from './MessageContainer'
33

44
const meta = {
55
title: 'Components/Containers/MessageContainer',

web/common/src/components/MessageContainer/MessageContainer.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@ import { cn } from '@/utils'
22
import { LoadingContainer } from '../LoadingContainer/LoadingContainer'
33
import { HorizontalContainer } from '../HorizontalContainer/HorizontalContainer'
44

5-
export default function MessageContainer({
6-
children,
7-
className,
8-
wrap = false,
9-
isLoading = false,
10-
}: {
5+
export interface MessageContainerProps {
116
children: React.ReactNode
127
className?: string
138
wrap?: boolean
149
isLoading?: boolean
15-
}) {
10+
}
11+
12+
export function MessageContainer({
13+
children,
14+
className,
15+
wrap = false,
16+
isLoading = false,
17+
}: MessageContainerProps) {
1618
return (
1719
<HorizontalContainer
1820
data-component="MessageContainer"

web/common/src/components/Tooltip/Tooltip.tsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@ import {
88
import React from 'react'
99

1010
import { cn } from '@/utils'
11-
import type { Position } from '@/types'
1211

1312
import './Tooltip.css'
1413

15-
export type TooltipSide = Extract<Position, 'top' | 'bottom' | 'left' | 'right'>
16-
export type TooltipAlign = Extract<Position, 'center' | 'start' | 'end'>
14+
export interface TooltipProps {
15+
trigger: React.ReactNode
16+
children: React.ReactNode
17+
side?: 'top' | 'bottom' | 'left' | 'right'
18+
align?: 'center' | 'start' | 'end'
19+
delayDuration?: number
20+
sideOffset?: number
21+
alignOffset?: number
22+
className?: string
23+
}
1724

1825
export function Tooltip({
1926
delayDuration = 200,
@@ -24,16 +31,7 @@ export function Tooltip({
2431
trigger,
2532
children,
2633
className,
27-
}: {
28-
trigger: React.ReactNode
29-
children: React.ReactNode
30-
side?: TooltipSide
31-
align?: TooltipAlign
32-
delayDuration?: number
33-
sideOffset?: number
34-
alignOffset?: number
35-
className?: string
36-
}) {
34+
}: TooltipProps) {
3735
return (
3836
<TooltipProvider delayDuration={delayDuration}>
3937
<TooltipRoot>

web/common/src/components/Typography/Description.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import { cn } from '@/utils'
22
import React from 'react'
33

4+
export interface DescriptionProps {
5+
children?: React.ReactNode
6+
className?: string
7+
}
8+
49
export function Description({
510
children,
611
className,
712
...props
8-
}: {
9-
children?: React.ReactNode
10-
className?: string
11-
}) {
13+
}: DescriptionProps) {
1214
return (
1315
<div
1416
data-component="Description"

web/common/src/components/Typography/Headline.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@ import { getHeadlineTextSize } from './help'
33
import type { HeadlineLevel } from '@/types'
44
import { cn } from '@/utils'
55

6+
export interface HeadlineProps {
7+
level: HeadlineLevel
8+
children: React.ReactNode
9+
className?: string
10+
}
11+
612
export function Headline({
713
level = 1,
814
children,
915
className,
1016
...props
11-
}: {
12-
level: HeadlineLevel
13-
children: React.ReactNode
14-
className?: string
15-
}) {
17+
}: HeadlineProps) {
1618
const Tag = `h${level}` as keyof JSX.IntrinsicElements
1719

1820
return (

web/common/src/components/Typography/Information.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ import { getTextSize } from './help'
66
import type { Size } from '@/types'
77
import { Tooltip } from '../Tooltip/Tooltip'
88

9+
export interface InformationProps {
10+
children?: React.ReactNode
11+
className?: string
12+
classNameTooltip?: string
13+
side?: 'right' | 'left'
14+
size?: Size
15+
sideOffset?: number
16+
delayDuration?: number
17+
info?: React.ReactNode
18+
infoIcon?: React.ReactNode
19+
}
20+
921
export function Information({
1022
children,
1123
className,
@@ -22,17 +34,7 @@ export function Information({
2234
/>
2335
),
2436
...props
25-
}: {
26-
children?: React.ReactNode
27-
className?: string
28-
classNameTooltip?: string
29-
side?: 'right' | 'left'
30-
size?: Size
31-
sideOffset?: number
32-
delayDuration?: number
33-
info?: React.ReactNode
34-
infoIcon?: React.ReactNode
35-
}) {
37+
}: InformationProps) {
3638
return (
3739
<div
3840
data-component="Information"

web/common/src/components/Typography/Tagline.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { cn } from '@/utils'
22

3-
export function Tagline({
4-
className,
5-
children,
6-
...props
7-
}: {
3+
export interface TaglineProps {
84
className?: string
95
children?: React.ReactNode
10-
}) {
6+
}
7+
8+
export function Tagline({ className, children, ...props }: TaglineProps) {
119
return (
1210
<div
1311
data-component="Tagline"

web/common/src/components/Typography/Text.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { cn } from '@/utils'
22

3-
export function Text({
4-
className,
5-
children,
6-
...props
7-
}: {
3+
export interface TextProps {
84
className?: string
95
children?: React.ReactNode
10-
}) {
6+
}
7+
8+
export function Text({ className, children, ...props }: TextProps) {
119
return (
1210
<div
1311
data-component="Text"

web/common/src/components/VirtualList/FilterableList.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,19 @@ import { VerticalContainer } from '../VerticalContainer/VerticalContainer'
55
import { HorizontalContainer } from '../HorizontalContainer/HorizontalContainer'
66
import { Badge } from '../Badge/Badge'
77
import { cn } from '@/utils'
8-
import MessageContainer from '../MessageContainer/MessageContainer'
8+
import { MessageContainer } from '../MessageContainer/MessageContainer'
99
import { Input } from '../Input/Input'
1010

11+
export interface FilterableListProps<TItem> {
12+
items: TItem[]
13+
filterOptions?: IFuseOptions<TItem>
14+
disabled?: boolean
15+
placeholder?: string
16+
autoFocus?: boolean
17+
className?: string
18+
children: (options: TItem[], resetSearch: () => void) => React.ReactNode
19+
}
20+
1121
export function FilterableList<TItem>({
1222
items,
1323
disabled,
@@ -16,15 +26,7 @@ export function FilterableList<TItem>({
1626
filterOptions,
1727
className,
1828
children,
19-
}: {
20-
items: TItem[]
21-
filterOptions?: IFuseOptions<TItem>
22-
disabled?: boolean
23-
placeholder?: string
24-
autoFocus?: boolean
25-
className?: string
26-
children: (options: TItem[], resetSearch: () => void) => React.ReactNode
27-
}) {
29+
}: FilterableListProps<TItem>) {
2830
const [search, setSearch] = React.useState('')
2931

3032
const fuse = new Fuse(items, filterOptions)

web/common/src/components/VirtualList/VirtualList.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@ import { Button } from '../Button/Button'
66
import { ScrollContainer } from '../ScrollContainer/ScrollContainer'
77
import { VerticalContainer } from '../VerticalContainer/VerticalContainer'
88

9+
export interface VirtualListProps<TItem> {
10+
items: TItem[]
11+
estimatedListItemHeight: number
12+
renderListItem: (item: TItem) => React.ReactNode
13+
isSelected?: (item: TItem) => boolean
14+
className?: string
15+
}
16+
917
export function VirtualList<TItem>({
1018
items,
1119
estimatedListItemHeight,
1220
renderListItem,
1321
isSelected,
1422
className,
15-
}: {
16-
items: TItem[]
17-
estimatedListItemHeight: number
18-
renderListItem: (item: TItem) => React.ReactNode
19-
isSelected?: (item: TItem) => boolean
20-
className?: string
21-
}) {
23+
}: VirtualListProps<TItem>) {
2224
const scrollableAreaRef = React.useRef<HTMLDivElement>(null)
2325

2426
const [activeItemIndex] = React.useMemo(() => {

0 commit comments

Comments
 (0)