Skip to content

Commit

Permalink
feat(fuselage): Add forwardRef on Contextualbar (#1319)
Browse files Browse the repository at this point in the history
  • Loading branch information
dougfabris authored Mar 13, 2024
1 parent 9dec916 commit b37dd11
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 28 deletions.
5 changes: 5 additions & 0 deletions .changeset/short-waves-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/fuselage": minor
---

feat(fuselage): Add forwardRef on Contextualbar
58 changes: 30 additions & 28 deletions packages/fuselage/src/components/Contextualbar/Contextualbar.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
import type { ComponentProps } from 'react';
import React, { memo } from 'react';
import React, { forwardRef, memo } from 'react';

import { Box } from '..';

type ContextualbarProps = ComponentProps<typeof Box>;

const Contextualbar = ({
children,
width,
position,
bg = 'room',
...props
}: ContextualbarProps) => (
<Box
rcx-vertical-bar
bg={bg}
color='default'
display='flex'
flexDirection='column'
flexShrink={0}
width={width}
borderInlineStartWidth='default'
borderInlineStartColor='extra-light'
borderInlineStartStyle='solid'
height='full'
position={position}
insetInlineEnd='none'
insetBlockStart='none'
zIndex={5}
{...props}
>
{children}
</Box>
const Contextualbar = forwardRef<HTMLElement, ContextualbarProps>(
function Contextualbar(
{ children, width, position, bg = 'room', ...props },
ref
) {
return (
<Box
ref={ref}
rcx-vertical-bar
bg={bg}
color='default'
display='flex'
flexDirection='column'
flexShrink={0}
width={width}
borderInlineStartWidth='default'
borderInlineStartColor='extra-light'
borderInlineStartStyle='solid'
height='full'
position={position}
insetInlineEnd='none'
insetBlockStart='none'
zIndex={5}
{...props}
>
{children}
</Box>
);
}
);

export default memo(Contextualbar);

0 comments on commit b37dd11

Please sign in to comment.