-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
bengotow
committed
Apr 16, 2024
1 parent
4077253
commit dd385af
Showing
5 changed files
with
109 additions
and
63 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
73 changes: 14 additions & 59 deletions
73
js_modules/dagster-ui/packages/ui-core/src/runs/RepoSectionHeader.tsx
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
61 changes: 61 additions & 0 deletions
61
js_modules/dagster-ui/packages/ui-core/src/workspace/TableSectionHeader.tsx
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,61 @@ | ||
import {Box, Colors, Icon, IconWrapper} from '@dagster-io/ui-components'; | ||
import styled from 'styled-components'; | ||
|
||
export const SECTION_HEADER_HEIGHT = 32; | ||
|
||
export interface TableSectionHeaderProps { | ||
expanded: boolean; | ||
onClick: (e: React.MouseEvent) => void; | ||
children?: React.ReactNode; | ||
rightElement?: React.ReactNode; | ||
} | ||
|
||
export const TableSectionHeader = (props: TableSectionHeaderProps) => { | ||
const {expanded, onClick, children, rightElement} = props; | ||
return ( | ||
<SectionHeaderButton $open={expanded} onClick={onClick}> | ||
<Box | ||
flex={{alignItems: 'center', justifyContent: 'space-between'}} | ||
padding={{horizontal: 24}} | ||
> | ||
{children} | ||
<Box flex={{alignItems: 'center', gap: 8}}> | ||
{rightElement} | ||
<Box margin={{top: 2}}> | ||
<Icon name="arrow_drop_down" /> | ||
</Box> | ||
</Box> | ||
</Box> | ||
</SectionHeaderButton> | ||
); | ||
}; | ||
|
||
const SectionHeaderButton = styled.button<{$open: boolean}>` | ||
background-color: ${Colors.backgroundLight()}; | ||
border: 0; | ||
box-shadow: | ||
inset 0px -1px 0 ${Colors.keylineDefault()}, | ||
inset 0px 1px 0 ${Colors.keylineDefault()}; | ||
color: ${Colors.textLight()}; | ||
cursor: pointer; | ||
display: block; | ||
padding: 0; | ||
width: 100%; | ||
margin: 0; | ||
height: ${SECTION_HEADER_HEIGHT}px; | ||
text-align: left; | ||
:focus, | ||
:active { | ||
outline: none; | ||
} | ||
:hover { | ||
background-color: ${Colors.backgroundLightHover()}; | ||
} | ||
${IconWrapper}[aria-label="arrow_drop_down"] { | ||
transition: transform 100ms linear; | ||
${({$open}) => ($open ? null : `transform: rotate(-90deg);`)} | ||
} | ||
`; |