File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -3,11 +3,24 @@ import type React from 'react'
3
3
import classes from './_TokenTextContainer.module.css'
4
4
import { clsx } from 'clsx'
5
5
6
- const TokenTextContainer = ( { children, id, ...props } : React . PropsWithChildren < Partial < TokenBaseProps > > ) => {
6
+ const TokenTextContainer = ( {
7
+ children,
8
+ id,
9
+ as : Component = 'span' ,
10
+ ...props
11
+ } : React . PropsWithChildren < Partial < TokenBaseProps > > ) => {
7
12
return (
8
- < span className = { clsx ( classes . TokenTextContainer ) } id = { id ?. toString ( ) } { ...props } >
13
+ < Component
14
+ className = { clsx ( classes . TokenTextContainer ) }
15
+ id = { id ?. toString ( ) }
16
+ { ...( Component === 'button'
17
+ ? ( props as React . ButtonHTMLAttributes < HTMLButtonElement > )
18
+ : Component === 'a'
19
+ ? ( props as React . AnchorHTMLAttributes < HTMLAnchorElement > )
20
+ : ( props as React . HTMLAttributes < HTMLSpanElement > ) ) }
21
+ >
9
22
{ children }
10
- </ span >
23
+ </ Component >
11
24
)
12
25
}
13
26
You can’t perform that action at this time.
0 commit comments