File tree Expand file tree Collapse file tree 1 file changed +2
-16
lines changed Expand file tree Collapse file tree 1 file changed +2
-16
lines changed Original file line number Diff line number Diff line change 1
1
import React , { useState } from 'react' ;
2
2
import AnimateHeight from 'react-animate-height' ;
3
3
4
- import { useColorMode } from '@docusaurus/theme-common' ;
5
-
6
4
type ChipProps = {
7
5
children ?: string ;
8
6
} ;
9
7
10
- const COLORS = {
11
- dark : {
12
- description : 'border-gray-200 bg-neutral-600 text-gray-200' ,
13
- } ,
14
- light : {
15
- description : 'border-neutral-500 bg-gray-200 text-neutral-600' ,
16
- } ,
17
- } as const ;
18
-
19
8
export const Chip = ( { children } : ChipProps ) => {
20
- const { colorMode } = useColorMode ( ) ;
21
9
const [ descriptionHeight , setDescriptionHeight ] = useState < 'auto' | 0 > ( 0 ) ;
22
10
23
11
return (
24
12
< div className = "mb-2" >
25
13
< div
26
- className = { ` mb-1 inline-flex cursor-pointer items-center rounded-lg bg-neutral-500 px-1.5 text-[11px] font-normal text-gray-200 dark:bg-gray-200 dark:text-neutral-600` }
14
+ className = " mb-1 inline-flex cursor-pointer items-center rounded-lg bg-neutral-500 px-1.5 text-[11px] font-normal text-gray-200 dark:bg-gray-200 dark:text-neutral-600"
27
15
onClick = { ( ) => setDescriptionHeight ( ( prev ) => ( prev === 0 ? 'auto' : 0 ) ) }
28
16
>
29
17
< div className = "mr-1" > Note</ div >
30
18
< InfoIcon />
31
19
</ div >
32
20
< AnimateHeight duration = { 500 } easing = "ease" height = { descriptionHeight } >
33
- < div
34
- className = { `rounded-md border-0 border-l-[5px] border-solid p-2 text-xs italic [&_p]:mb-0 ${ COLORS [ colorMode ] . description } ` }
35
- >
21
+ < div className = "rounded-md border-0 border-l-[5px] border-solid border-neutral-500 bg-gray-200 p-2 text-xs italic text-neutral-600 dark:border-gray-200 dark:bg-neutral-600 dark:text-gray-200 [&_p]:mb-0" >
36
22
{ children }
37
23
</ div >
38
24
</ AnimateHeight >
You can’t perform that action at this time.
0 commit comments