Skip to content

Commit 9107c0d

Browse files
committed
added expandable panel
1 parent 1c91e3a commit 9107c0d

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import React from 'react'
2+
import {useCollapse} from 'react-collapsed'
3+
4+
const ExpandablePanel = (props) => {
5+
const {getCollapseProps, getToggleProps, isExpanded} = useCollapse()
6+
const {title, innerInfo} = props
7+
return (
8+
<div className="border rounded-md bg-gray-700 border-gray-700 py-2 w-full" key={`expandablePanel`}>
9+
<div {...getToggleProps()}>
10+
<div>
11+
<span className="text-m">
12+
{title}&nbsp;
13+
{isExpanded ? (
14+
<svg
15+
xmlns="http://www.w3.org/2000/svg"
16+
width="16"
17+
height="16"
18+
viewBox="0 0 16 16"
19+
fill="none"
20+
stroke="currentColor"
21+
strokeWidth="2"
22+
strokeLinecap="round"
23+
strokeLinejoin="round"
24+
className="inline align-text-bottom feather feather-arrow-down"
25+
>
26+
<line x1="8" y1="3" x2="8" y2="12"></line>
27+
<polyline points="13 8 8 12 3 8"></polyline>
28+
</svg>
29+
) : (
30+
<svg
31+
xmlns="http://www.w3.org/2000/svg"
32+
width="16"
33+
height="16"
34+
viewBox="0 0 16 16"
35+
fill="none"
36+
stroke="currentColor"
37+
strokeWidth="2"
38+
strokeLinecap="round"
39+
strokeLinejoin="round"
40+
className="inline align-text-bottom feather feather-arrow-up"
41+
>
42+
<line x1="8" y1="3" x2="8" y2="13"></line>
43+
<polyline points="3 8 8 3 13 8"></polyline>
44+
</svg>
45+
)}
46+
</span>
47+
</div>
48+
</div>
49+
<div {...getCollapseProps()}>
50+
<div className="pt-1">
51+
<textarea
52+
className="w-full h-64 rounded bg-gray-900 text-white px-2 readonly"
53+
readOnly
54+
value={innerInfo}
55+
></textarea>
56+
</div>
57+
</div>
58+
</div>
59+
)
60+
}
61+
62+
export default ExpandablePanel

0 commit comments

Comments
 (0)