-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chore: Convert VerticalBar component to typescript (#22542)
* improve: component to ts * fix: review * Merge branch 'develop' into improve/vertical-bar * fix: types Co-authored-by: gabriellsh <[email protected]> Co-authored-by: Tasso Evangelista <[email protected]>
- Loading branch information
1 parent
5443be7
commit 0118745
Showing
33 changed files
with
177 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ActionButton } from '@rocket.chat/fuselage'; | ||
import React, { ReactElement, memo, MouseEventHandler } from 'react'; | ||
|
||
const VerticalBarAction = ({ | ||
name, | ||
...props | ||
}: { | ||
name: string; | ||
title?: string; | ||
onClick?: MouseEventHandler<HTMLOrSVGElement>; | ||
}): ReactElement => <ActionButton flexShrink={0} icon={name} ghost {...props} tiny />; | ||
|
||
export default memo(VerticalBarAction); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React, { ReactElement, memo, ComponentProps } from 'react'; | ||
|
||
import VerticalBarAction from './VerticalBarAction'; | ||
|
||
const VerticalBarActionBack = (props: ComponentProps<typeof VerticalBarAction>): ReactElement => ( | ||
<VerticalBarAction {...props} name='arrow-back' /> | ||
); | ||
|
||
export default memo(VerticalBarActionBack); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ButtonGroup } from '@rocket.chat/fuselage'; | ||
import React, { memo, ReactElement, ComponentProps } from 'react'; | ||
|
||
const VerticalBarActions = (props: ComponentProps<typeof ButtonGroup>): ReactElement => ( | ||
<ButtonGroup medium {...props} /> | ||
); | ||
|
||
export default memo(VerticalBarActions); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Button } from '@rocket.chat/fuselage'; | ||
import React, { ComponentProps, memo, ReactElement } from 'react'; | ||
|
||
const VerticalBarButton = (props: ComponentProps<typeof Button>): ReactElement => ( | ||
<Button small square flexShrink={0} ghost {...props} /> | ||
); | ||
|
||
export default memo(VerticalBarButton); |
8 changes: 5 additions & 3 deletions
8
...omponents/VerticalBar/VerticalBarClose.js → ...mponents/VerticalBar/VerticalBarClose.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import React, { memo } from 'react'; | ||
import React, { memo, ComponentProps, ReactElement } from 'react'; | ||
|
||
import { useTranslation } from '../../contexts/TranslationContext'; | ||
import VerticalBarAction from './VerticalBarAction'; | ||
|
||
function VerticalBarClose(props) { | ||
type VerticalBarCloseProps = Partial<ComponentProps<typeof VerticalBarAction>>; | ||
|
||
const VerticalBarClose = (props: VerticalBarCloseProps): ReactElement => { | ||
const t = useTranslation(); | ||
return <VerticalBarAction {...props} title={t('Close')} name='cross' />; | ||
} | ||
}; | ||
|
||
export default memo(VerticalBarClose); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import React, { ComponentProps, forwardRef, memo } from 'react'; | ||
|
||
import Page from '../Page'; | ||
|
||
const VerticalBarContent = forwardRef<HTMLElement, ComponentProps<typeof Page.Content>>( | ||
function VerticalBarContent(props, ref) { | ||
return <Page.Content rcx-vertical-bar__content display='flex' {...props} ref={ref} />; | ||
}, | ||
); | ||
|
||
export default memo(VerticalBarContent); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Box } from '@rocket.chat/fuselage'; | ||
import React, { forwardRef, ComponentProps, memo } from 'react'; | ||
|
||
const VerticalBarFooter = forwardRef<HTMLElement, ComponentProps<typeof Box>>( | ||
function VerticalBarFooter({ children, ...props }, ref) { | ||
return ( | ||
<Box is='footer' p='x24' {...props} ref={ref}> | ||
{children} | ||
</Box> | ||
); | ||
}, | ||
); | ||
|
||
export default memo(VerticalBarFooter); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Box, Margins } from '@rocket.chat/fuselage'; | ||
import React, { FC, memo, ReactNode, ComponentProps } from 'react'; | ||
|
||
const VerticalBarHeader: FC<{ children: ReactNode; props?: ComponentProps<typeof Box> }> = ({ | ||
children, | ||
...props | ||
}) => ( | ||
<Box | ||
display='flex' | ||
alignItems='center' | ||
minHeight='56px' | ||
maxHeight='56px' | ||
is='h3' | ||
pi='x24' | ||
borderBlockEndWidth='x2' | ||
borderBlockColor='neutral-200' | ||
{...props} | ||
> | ||
<Box | ||
marginInline='neg-x4' | ||
display='flex' | ||
alignItems='center' | ||
justifyContent='space-between' | ||
fontScale='s2' | ||
flexGrow={1} | ||
overflow='hidden' | ||
color='neutral-800' | ||
> | ||
<Margins inline='x4'>{children}</Margins> | ||
</Box> | ||
</Box> | ||
); | ||
|
||
export default memo(VerticalBarHeader); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Icon } from '@rocket.chat/fuselage'; | ||
import React, { ReactElement, ComponentProps, memo } from 'react'; | ||
|
||
const VerticalBarIcon = (props: ComponentProps<typeof Icon>): ReactElement => ( | ||
<Icon {...props} pi='x2' size='x24' /> | ||
); | ||
|
||
export default memo(VerticalBarIcon); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Box } from '@rocket.chat/fuselage'; | ||
import React, { ReactElement, memo, ComponentProps } from 'react'; | ||
|
||
const VerticalBarInnerContent = (props: ComponentProps<typeof Box>): ReactElement => ( | ||
<Box | ||
rcx-vertical-bar--inner-content | ||
position='absolute' | ||
height='full' | ||
display='flex' | ||
insetInline={0} | ||
{...props} | ||
/> | ||
); | ||
|
||
export default memo(VerticalBarInnerContent); |
10 changes: 5 additions & 5 deletions
10
...rticalBar/VerticalBarScrollableContent.js → ...ticalBar/VerticalBarScrollableContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Box, Skeleton } from '@rocket.chat/fuselage'; | ||
import React, { ReactElement, ComponentProps, memo } from 'react'; | ||
|
||
import VerticalBar from './VerticalBar'; | ||
import VerticalBarHeader from './VerticalBarHeader'; | ||
|
||
const VerticalBarSkeleton = (props: ComponentProps<typeof Box>): ReactElement => ( | ||
<VerticalBar {...props} width='100%'> | ||
<VerticalBarHeader> | ||
<Skeleton width='100%' /> | ||
</VerticalBarHeader> | ||
<Box p='x24'> | ||
<Skeleton width='32px' height='32px' variant='rect' /> <Skeleton /> | ||
{Array(5) | ||
.fill(5) | ||
.map((_, index) => ( | ||
<Skeleton key={index} /> | ||
))} | ||
</Box> | ||
</VerticalBar> | ||
); | ||
|
||
export default memo(VerticalBarSkeleton); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.