-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dashboards): enable optional light mode for dashboards (#17232)
* refactor(ui): distill presentation mode toggle into discreet component * refactor(ui): introduce foundations for Light Mode * fix(ui): ensure light mode does not affect dashboards index view * feat(ui): enable light mode for some chart types * refactor(ui): adapt dashboard page title to light mode * refactor(ui): polish appearance of cells in light mode * fix(ui): make detection of dashboard viewing more resilient and precise * fix(ui): pass in missing prop * feat(ui): allow gauge to render as either light or dark * fix(ui): ensure light mode of gauge is scoped to dashboard cells and not veo * feat(ui): refactor table graphs to conditionally render light mode * feat(ui): enable Heatmap graphs to render in light mode * feat(ui): enable histograms to render in light mode * feat(ui): enable scatterplots to render in light mode * fix(ui): remove console log * fix(ui): update test * refactor: calc theme state * fix: type * refactor: fix action types * chore: remove dead code * refactor(ui): rename props from "lightMode" to "theme" * refactor(ui): make variables control bar respond to theme * fix(ui): update mockState to match current appState shape * fix(ui): update affected tests * refactor(theme): remove currentPage from localStorage * chore(ui): update changelog * fix(ui): update test Co-authored-by: Andrew Watkins <watts@influxdb.com> Co-authored-by: Andrew Watkins <andrew.watkinz@gmail.com>
- Loading branch information
1 parent
0ec2b45
commit b0d459f
Showing
36 changed files
with
785 additions
and
273 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* | ||
Light Mode for Dashboards | ||
------------------------------------------------------------------------------ | ||
*/ | ||
|
||
.clockface--app-wrapper.dashboard-light-mode { | ||
background-color: $g18-cloud; | ||
color: $g8-storm; | ||
|
||
.cf-page-contents > .cf-dapper-scrollbars--track-y { | ||
background-color: $g15-platinum !important; | ||
} | ||
|
||
.cf-page--sub-title { | ||
color: $g13-mist; | ||
} | ||
|
||
.cell { | ||
background-color: $g20-white; | ||
} | ||
|
||
.cell--dot-grid, | ||
.cell--dot-grid:before, | ||
.cell--dot-grid:after { | ||
background-color: $g13-mist; | ||
} | ||
|
||
.cell:hover .cell--dot-grid, | ||
.cell:hover .cell--dot-grid:before, | ||
.cell:hover .cell--dot-grid:after { | ||
background-color: $g8-storm; | ||
} | ||
|
||
.cell:hover .cell--draggable:hover .cell--dot-grid, | ||
.cell:hover .cell--draggable:hover .cell--dot-grid:before, | ||
.cell:hover .cell--draggable:hover .cell--dot-grid:after { | ||
background-color: $c-pool; | ||
} | ||
|
||
.cell--context { | ||
color: $g13-mist; | ||
} | ||
.cell:hover .cell--context { | ||
color: $g8-storm; | ||
} | ||
.cell:hover .cell--context:hover, | ||
.cell .cell--context.cell--context__active, | ||
.cell:hover .cell--context.cell--context__active { | ||
color: $c-pool; | ||
} | ||
|
||
.cell--note-indicator { | ||
color: $g13-mist; | ||
|
||
&.cell--note-indicator__active, | ||
&:hover, | ||
.cell:hover &:hover { | ||
color: $c-pool; | ||
} | ||
} | ||
|
||
.markdown-format { | ||
color: $g7-graphite; | ||
|
||
code { | ||
font-weight: 700; | ||
color: $c-star; | ||
} | ||
} | ||
|
||
.cell--view-empty { | ||
color: $g11-sidewalk; | ||
} | ||
.variables-control-bar--empty, | ||
.variables-control-bar--full { | ||
background-color: $g20-white; | ||
} | ||
} | ||
|
||
/* | ||
Light Mode Cells | ||
------------------------------------------------------------------------------ | ||
*/ | ||
|
||
.clockface--app-wrapper.dashboard-light-mode { | ||
.react-resizable-handle { | ||
border-right-color: $g14-chromium; | ||
border-bottom-color: $g14-chromium; | ||
|
||
&:before, | ||
&:after { | ||
background-color: $g20-white; | ||
} | ||
|
||
&:hover { | ||
border-right-color: $c-comet; | ||
border-bottom-color: $c-comet; | ||
} | ||
} | ||
.react-grid-item.resizing .react-resizable-handle, | ||
.react-grid-item.react-draggable-dragging .react-resizable-handle { | ||
opacity: 1; | ||
border-right-color: $c-comet; | ||
border-bottom-color: $c-comet; | ||
} | ||
} |
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,66 @@ | ||
// Libraries | ||
import React, {FC} from 'react' | ||
import {connect} from 'react-redux' | ||
|
||
// Components | ||
import {SelectGroup} from '@influxdata/clockface' | ||
|
||
// Actions | ||
import {setTheme} from 'src/shared/actions/app' | ||
|
||
// Types | ||
import {AppState, Theme} from 'src/types' | ||
|
||
interface StateProps { | ||
theme: Theme | ||
} | ||
|
||
interface DispatchProps { | ||
onSetTheme: typeof setTheme | ||
} | ||
|
||
interface OwnProps {} | ||
|
||
type Props = OwnProps & StateProps & DispatchProps | ||
|
||
const DashboardLightModeToggle: FC<Props> = ({theme, onSetTheme}) => { | ||
return ( | ||
<SelectGroup testID="presentation-mode-toggle"> | ||
<SelectGroup.Option | ||
onClick={() => onSetTheme('dark')} | ||
value={false} | ||
id="presentation-mode-toggle--dark" | ||
active={theme === 'dark'} | ||
> | ||
Dark | ||
</SelectGroup.Option> | ||
<SelectGroup.Option | ||
onClick={() => onSetTheme('light')} | ||
id="presentation-mode-toggle--light" | ||
value={true} | ||
active={theme === 'light'} | ||
> | ||
Light | ||
</SelectGroup.Option> | ||
</SelectGroup> | ||
) | ||
} | ||
|
||
const mstp = (state: AppState): StateProps => { | ||
const { | ||
app: { | ||
persisted: {theme}, | ||
}, | ||
} = state | ||
|
||
return {theme} | ||
} | ||
|
||
const mdtp: DispatchProps = { | ||
onSetTheme: setTheme, | ||
} | ||
|
||
export default connect<StateProps, DispatchProps, OwnProps>( | ||
mstp, | ||
mdtp | ||
)(DashboardLightModeToggle) |
Oops, something went wrong.