-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: put measurements actions in a toolbar and add button to delete …
…measurements (#426)
- Loading branch information
1 parent
f0720f3
commit 308048e
Showing
8 changed files
with
185 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** @jsxImportSource @emotion/react */ | ||
import { css } from '@emotion/react'; | ||
import { ReactNode } from 'react'; | ||
|
||
const styles = { | ||
root: css` | ||
display: inline-flex; | ||
border-radius: 0.375rem; | ||
isolation: isolate; | ||
`, | ||
firstButton: css` | ||
position: relative; | ||
display: inline-flex; | ||
align-items: center; | ||
font-weight: 500; | ||
font-size: 0.875rem; | ||
line-height: 1.25rem; | ||
padding-left: 1rem; | ||
padding-right: 1rem; | ||
padding-top: 5px; | ||
padding-bottom: 5px; | ||
border-width: 1px; | ||
border-top-left-radius: 0.375rem; | ||
border-bottom-left-radius: 0.375rem; | ||
`, | ||
secondButton: css` | ||
position: relative; | ||
display: inline-flex; | ||
align-items: center; | ||
font-weight: 500; | ||
font-size: 0.875rem; | ||
line-height: 1.25rem; | ||
padding-left: 1rem; | ||
padding-right: 1rem; | ||
padding-top: 5px; | ||
padding-bottom: 5px; | ||
border-width: 1px; | ||
border-top-right-radius: 0.375rem; | ||
border-bottom-right-radius: 0.375rem; | ||
margin-left: -1px; | ||
`, | ||
}; | ||
|
||
interface ButtonGroupProps { | ||
children: [ReactNode, ReactNode]; | ||
} | ||
|
||
export function ButtonGroup(props: ButtonGroupProps) { | ||
const { children } = props; | ||
return <div css={styles.root}>{children}</div>; | ||
} | ||
|
||
interface ButtonGroupButtonProps { | ||
position: 'first' | 'last'; | ||
label: string; | ||
onClick: () => void; | ||
} | ||
|
||
ButtonGroup.Button = function ButtonGroupButton(props: ButtonGroupButtonProps) { | ||
const { position, label, onClick } = props; | ||
|
||
return ( | ||
<button | ||
type="button" | ||
onClick={onClick} | ||
css={position === 'first' ? styles.firstButton : styles.secondButton} | ||
> | ||
{label} | ||
</button> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './Button'; | ||
export * from './ButtonGroup'; |