Skip to content

Commit 1cf1df6

Browse files
authored
refactor: infotable vanilla extract (#5714)
1 parent d0140bb commit 1cf1df6

File tree

8 files changed

+246
-448
lines changed

8 files changed

+246
-448
lines changed

.changeset/dull-news-return.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@ultraviolet/plus": minor
3+
"@ultraviolet/ui": minor
4+
---
5+
6+
- Refactor component `InfoTable` to use vanilla extract instead of Emotion
7+
- Add prop "style" to `Row`

packages/plus/src/components/InfoTable/InfoTable.tsx

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,10 @@
11
'use client'
22

3-
import styled from '@emotion/styled'
43
import type { ReactNode } from 'react'
54
import { InfoTableCell } from './components/Cell'
6-
import { InfoTableRow, StyledRow } from './components/Row'
7-
8-
const StyledDl = styled('dl', {
9-
shouldForwardProp: prop => !['width'].includes(prop),
10-
})<{ width?: string }>`
11-
display: flex;
12-
font-size: ${({ theme }) => theme.typography.body.fontSize};
13-
line-height: ${({ theme }) => theme.typography.body.lineHeight};
14-
flex-direction: column;
15-
align-items: start;
16-
margin: 0;
17-
width: 100%;
18-
19-
${StyledRow} {
20-
width: ${({ width }) => width ?? '100%'};
21-
}
22-
`
5+
import { InfoTableRow } from './components/Row'
6+
import { InfoTableContext } from './context'
7+
import { dl } from './styles.css'
238

249
type InfoTableProps = {
2510
children: ReactNode
@@ -38,9 +23,14 @@ export const InfoTable = ({
3823
className,
3924
'data-testid': dataTestId,
4025
}: InfoTableProps) => (
41-
<StyledDl className={className} data-testid={dataTestId} width={width}>
42-
{children}
43-
</StyledDl>
26+
<InfoTableContext.Provider value={{ width }}>
27+
<dl
28+
className={`${className ? `${className} ` : ''}${dl}`}
29+
data-testid={dataTestId}
30+
>
31+
{children}
32+
</dl>
33+
</InfoTableContext.Provider>
4434
)
4535

4636
InfoTable.Row = InfoTableRow

0 commit comments

Comments
 (0)