diff options
| author | Haishan <[email protected]> | 2020-03-20 22:19:56 +0800 |
|---|---|---|
| committer | Haishan <[email protected]> | 2020-03-21 13:33:43 +0800 |
| commit | 8e48c01e7aada6978e92a6da1d040f3ef0d37945 (patch) | |
| tree | 63cdf772b88d2cff340449ba98225bdbad526a19 /src/components/Button.js | |
| parent | c5d70b5236be5ce0fb067bab3c8eeb6e946a73dd (diff) | |
feat: remembers group collapse state
for https://github.com/haishanh/yacd/issues/480
Diffstat (limited to 'src/components/Button.js')
| -rw-r--r-- | src/components/Button.js | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/components/Button.js b/src/components/Button.js index d5b88cf..2ec0c22 100644 --- a/src/components/Button.js +++ b/src/components/Button.js @@ -16,10 +16,17 @@ type ButtonProps = { isLoading?: boolean, start?: Element | (() => Element), onClick?: (SyntheticEvent<HTMLButtonElement>) => mixed, - kind?: 'primary' | 'minimal' + kind?: 'primary' | 'minimal', + className?: string }; function Button(props: ButtonProps, ref) { - const { onClick, isLoading, kind = 'primary', ...restProps } = props; + const { + onClick, + isLoading, + kind = 'primary', + className, + ...restProps + } = props; const internalOnClick = useCallback( e => { if (isLoading) return; @@ -27,9 +34,13 @@ function Button(props: ButtonProps, ref) { }, [isLoading, onClick] ); - const btnClassName = cx(s0.btn, { - [s0.minimal]: kind === 'minimal' - }); + const btnClassName = cx( + s0.btn, + { + [s0.minimal]: kind === 'minimal' + }, + className + ); return ( <button className={btnClassName} ref={ref} onClick={internalOnClick}> {isLoading ? ( |
