1- import { styled } from '@mui/material/styles'
2- import { COLORS } from '../../../styles/theme/colors'
31import { backgroundColorAnimation } from '../../../styles/theme/animations'
42import { FC , HTMLAttributes } from 'react'
53import { cn } from '@oasisprotocol/ui-library/src/lib/utils'
@@ -18,57 +16,29 @@ export const InlineDescriptionList: FC<InlineDescriptionListProps> = ({ classNam
1816 )
1917}
2018
21- interface StyledDescriptionListProps {
19+ interface StyledDescriptionListProps extends HTMLAttributes < HTMLDListElement > {
2220 standalone ?: boolean
2321 highlight ?: boolean
2422}
2523
26- export const StyledDescriptionList = styled ( InlineDescriptionList , {
27- shouldForwardProp : prop => prop !== 'standalone' && prop !== 'highlight' ,
28- } ) < StyledDescriptionListProps > ( ( { theme, standalone, highlight } ) => ( {
29- 'dt, dd' : {
30- display : 'flex' ,
31- flexWrap : 'wrap' ,
32- boxShadow : `0px 1px 0px ${ COLORS . grayLight } ` ,
33- ':last-of-type' : {
34- boxShadow : 'none' ,
35- } ,
36- [ theme . breakpoints . down ( 'sm' ) ] : {
37- padding : theme . spacing ( 3 , 0 ) ,
38- } ,
39- [ theme . breakpoints . up ( 'sm' ) ] : {
40- padding : theme . spacing ( 4 , 0 ) ,
41- } ,
42- } ,
43- dt : {
44- color : COLORS . grayDark ,
45- alignItems : 'start' ,
46- } ,
47- dd : {
48- overflowWrap : 'anywhere' ,
49- alignItems : 'center' ,
50- maxWidth : '100%' ,
51- overflowX : 'hidden' ,
52- paddingLeft : '5px' , // Needed to fix highlightedAddress being clipped by overflow-x: hidden
53- } ,
54- ...( standalone && {
55- '&&' : {
56- padding : theme . spacing ( 3 , 4 ) ,
57- backgroundColor : COLORS . white ,
58- marginBottom : theme . spacing ( 4 ) ,
59- borderRadius : '6px' ,
60- } ,
61- } ) ,
62- ...( highlight && backgroundColorAnimation ) ,
63- } ) )
24+ export const StyledDescriptionList : FC < StyledDescriptionListProps > = ( {
25+ className,
26+ standalone,
27+ highlight,
28+ ...props
29+ } ) => (
30+ < dl
31+ className = { cn (
32+ 'm-0 grid grid-cols-[100px_auto] sm:grid-cols-[200px_auto] [&_dd]:m-0 [&_dt]:flex [&_dd]:flex [&_dt]:flex-wrap [&_dd]:flex-wrap [&_dt]:items-start [&_dd]:items-center [&_dt]:border-b [&_dd]:border-b border-foreground-muted [&_dt]:py-2 [&_dd]:py-2 sm:[&_dt]:py-4 sm:[&_dd]:py-4 [&_dd]:overflow-hidden [&_dd]:overflow-x-hidden [&_dd]:max-w-full [&_dd]:break-words [&_dd]:pl-1 [&_dd:last-of-type]:border-b-0 [&_dt:last-of-type]:border-b-0' ,
33+ standalone && 'py-2 px-4 mb-4 rounded-md border' ,
34+ highlight && 'animate-[flash_3.5s_ease-in-out_1]' ,
35+ className ,
36+ ) }
37+ style = { highlight ? backgroundColorAnimation : undefined }
38+ { ...props }
39+ />
40+ )
6441
65- export const StyledListTitleWithAvatar = styled ( 'dt' ) ( ( { theme } ) => ( {
66- '&&' : {
67- [ theme . breakpoints . down ( 'sm' ) ] : {
68- padding : theme . spacing ( 2 , 0 ) ,
69- } ,
70- [ theme . breakpoints . up ( 'sm' ) ] : {
71- padding : theme . spacing ( 3 , 0 ) ,
72- } ,
73- } ,
74- } ) )
42+ export const StyledListTitleWithAvatar : FC < HTMLAttributes < HTMLElement > > = ( { className, ...props } ) => (
43+ < dt className = { cn ( 'py-1! sm:py-2!' , className ) } { ...props } />
44+ )
0 commit comments