Skip to content

Commit 0e21122

Browse files
committed
fix(useTree/CellTree): add missing margin
1 parent 03959f8 commit 0e21122

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

src/common/components/Button/index.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ import { css, jsx } from '@emotion/react';
55

66
import styles from './styles';
77

8-
export const Button = React.forwardRef(
9-
(props: Record<string, any>, ref: React.ForwardedRef<HTMLButtonElement>) => {
10-
return <button type="button" ref={ref} {...props} css={styles} />;
8+
type ButtonProps = {
9+
margin: string;
10+
} & Record<string, any>;
11+
12+
export const Button: React.FC<ButtonProps> = React.forwardRef(
13+
({ margin, ...props }: ButtonProps, ref: React.ForwardedRef<HTMLButtonElement>) => {
14+
return <button type="button" ref={ref} {...props} css={styles({ margin })} />;
1115
},
1216
);

src/common/components/Button/styles.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/** @jsx jsx */
33
import { css, jsx } from '@emotion/react';
44

5-
export default css`
5+
export default ({ margin }: { margin: string }) => css`
66
display: flex;
77
align-items: center;
88
@@ -31,6 +31,14 @@ export default css`
3131
justify-content: center;
3232
}
3333
34+
&.prefix {
35+
margin-right: ${margin};
36+
}
37+
38+
&.suffix {
39+
margin-left: ${margin};
40+
}
41+
3442
div {
3543
text-align: left;
3644
overflow: hidden;

src/tree/CellTree.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export const CellTree: React.FC<CellTreeProps> = ({
9191
margin={icon ? mergedTreeIconOptions.margin : mergedTreeIconOptions.noIconMargin}
9292
onClick={handleClick}
9393
>
94-
{icon ? <span>{icon}</span> : <span />}
94+
{icon ? <div>{icon}</div> : <div />}
9595
</Button>
9696
<div>{children}</div>
9797
</div>

0 commit comments

Comments
 (0)