-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
5b7e881
commit 7096234
Showing
5 changed files
with
140 additions
and
87 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
30 changes: 30 additions & 0 deletions
30
packages/garden/src/lib/components/GroupingSelector/groupingSelector.styles.ts
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,30 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const StyledAutoCompleteWrapper = styled.div` | ||
display: flex; | ||
align-items: center; | ||
flex-direction: column; | ||
gap: 1em; | ||
`; | ||
|
||
export const StyledGroupHeader = styled.div` | ||
font-weight: 500px; | ||
padding-top: 2rem; | ||
`; | ||
export const StyledSubGroupHeader = styled.div` | ||
padding-left: 1rem; | ||
padding-top: 1rem; | ||
`; | ||
export const RadioWrapper = styled.div` | ||
display: flex; | ||
align-items: start; | ||
flex-direction: column; | ||
gap: 1em; | ||
`; | ||
|
||
export const RadioCategoryWrapper = styled.div` | ||
display: flex; | ||
align-items: start; | ||
flex-direction: column; | ||
gap: 0.1em; | ||
`; |
65 changes: 65 additions & 0 deletions
65
packages/garden/src/lib/components/ViewSettings/ViewSettings.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,65 @@ | ||
import { Button, Icon } from '@equinor/eds-core-react'; | ||
import { useState } from 'react'; | ||
|
||
import { arrow_back_ios, arrow_forward_ios, chevron_down, chevron_up } from '@equinor/eds-icons'; | ||
import { GardenDataSource } from '../Garden'; | ||
import { GroupingSelector } from '../GroupingSelector/GroupingSelector'; | ||
import { StyledViewSettings, VerticalText } from './viewSettings.styles'; | ||
|
||
interface ViewSettingsProps<TData extends Record<PropertyKey, unknown>, TContext = undefined> { | ||
dataSource: GardenDataSource<TContext>; | ||
context?: TContext; | ||
groupingKeys: string[]; | ||
timeInterval: string | null; | ||
dateVariant: string | null; | ||
onChangeTimeInterval: (timeInterval: string | null) => void; | ||
onChangeDateVariant: (dateVariant: string | null) => void; | ||
setGroupingKeys: (keys: string[]) => void; | ||
} | ||
|
||
Icon.add({ chevron_down, chevron_up }); | ||
|
||
export function ViewSettings<TData extends Record<PropertyKey, unknown>, TContext = undefined>({ | ||
dataSource, | ||
context, | ||
groupingKeys, | ||
timeInterval, | ||
dateVariant, | ||
onChangeTimeInterval, | ||
onChangeDateVariant, | ||
setGroupingKeys, | ||
}: ViewSettingsProps<TData, TContext>): JSX.Element | null { | ||
const [toggle, setToggle] = useState(false); | ||
|
||
return ( | ||
<StyledViewSettings expanded={toggle}> | ||
{toggle ? ( | ||
<> | ||
<div style={{ display: 'flex', width: '100%', alignItems: 'center', justifyContent: 'space-between' }}> | ||
<Button variant="ghost_icon" onClick={() => setToggle((state) => !state)}> | ||
<Icon data={arrow_forward_ios}></Icon> | ||
</Button> | ||
<p style={{ marginRight: '8px', fontSize: '16px', fontWeight: '500' }}>View Settings</p> | ||
</div> | ||
<GroupingSelector | ||
groupingKeys={groupingKeys} | ||
setGroupingKeys={setGroupingKeys} | ||
timeInterval={timeInterval} | ||
onChangeTimeInterval={onChangeTimeInterval} | ||
dateVariant={dateVariant} | ||
onChangeDateVarient={onChangeDateVariant} | ||
context={context as any} | ||
dataSource={dataSource} | ||
/> | ||
</> | ||
) : ( | ||
<> | ||
<Button variant="ghost_icon" onClick={() => setToggle((state) => !state)}> | ||
<Icon data={arrow_back_ios}></Icon> | ||
</Button> | ||
<VerticalText>View Settings</VerticalText> | ||
</> | ||
)} | ||
</StyledViewSettings> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
packages/garden/src/lib/components/ViewSettings/viewSettings.styles.ts
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,23 @@ | ||
import styled from 'styled-components'; | ||
|
||
type StyledViewSettingsProps = { | ||
expanded: boolean; | ||
}; | ||
|
||
export const StyledViewSettings = styled.div<StyledViewSettingsProps>` | ||
width: ${(props) => (props.expanded ? '300px' : '45px')}; | ||
box-shadow: -2px 0px 5px rgba(0, 0, 0, 0.1); | ||
margin-left: 10px; | ||
padding: 10px; | ||
transition: width 0.1s ease; | ||
overflow: hidden; | ||
`; | ||
export const VerticalText = styled.div` | ||
transform: rotate(90deg); | ||
white-space: nowrap; | ||
display: flex; | ||
align-items: center; | ||
margin-top: 3rem; | ||
justify-content: center; | ||
font-size: 16px; | ||
`; |