summaryrefslogtreecommitdiff
path: root/src/components/CollapsibleSectionHeader.js
diff options
context:
space:
mode:
authorHaishan <[email protected]>2020-02-10 22:53:14 +0800
committerHaishan <[email protected]>2020-02-10 23:04:57 +0800
commite85116bf717b51c0d4aa4f07c91944414f0a4b4e (patch)
tree63a6167eaeb7b1da842caafe47947d3997a65a38 /src/components/CollapsibleSectionHeader.js
parentbd82b8c5e3bad3efeecd9e2599b07128d290bea6 (diff)
refactor(Proxies): UI revamp
Diffstat (limited to 'src/components/CollapsibleSectionHeader.js')
-rw-r--r--src/components/CollapsibleSectionHeader.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/components/CollapsibleSectionHeader.js b/src/components/CollapsibleSectionHeader.js
new file mode 100644
index 0000000..aebb643
--- /dev/null
+++ b/src/components/CollapsibleSectionHeader.js
@@ -0,0 +1,34 @@
+import React from 'react';
+import { ChevronDown } from 'react-feather';
+import cx from 'classnames';
+
+import { SectionNameType } from './shared/Basic';
+import Button from './Button';
+
+import s from './CollapsibleSectionHeader.module.css';
+
+type Props = {
+ name: string,
+ type: string,
+ qty?: number,
+ toggle?: () => void,
+ isOpen?: boolean
+};
+
+export default function Header({ name, type, toggle, isOpen, qty }: Props) {
+ return (
+ <div className={s.header}>
+ <div onClick={toggle} style={{ cursor: 'pointer' }}>
+ <SectionNameType name={name} type={type} />
+ </div>
+
+ {typeof qty === 'number' ? <span className={s.qty}>{qty}</span> : null}
+
+ <Button kind="minimal" onClick={toggle}>
+ <span className={cx(s.arrow, { [s.isOpen]: isOpen })}>
+ <ChevronDown size={20} />
+ </span>
+ </Button>
+ </div>
+ );
+}