-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(dashboards): enable optional light mode for dashboards #17232
Merged
Merged
Changes from 27 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
0e835ae
refactor(ui): distill presentation mode toggle into discreet component
alexpaxton ec06fc8
refactor(ui): introduce foundations for Light Mode
alexpaxton 6390d22
fix(ui): ensure light mode does not affect dashboards index view
alexpaxton 29c2438
feat(ui): enable light mode for some chart types
alexpaxton 0579d78
chore(ui): Merge branch 'master' into feat/light-mode-dashboards
alexpaxton 74a1305
refactor(ui): adapt dashboard page title to light mode
alexpaxton 8bd2c6f
refactor(ui): polish appearance of cells in light mode
alexpaxton 334faa0
fix(ui): make detection of dashboard viewing more resilient and precise
alexpaxton f88734b
fix(ui): pass in missing prop
alexpaxton 97f5573
feat(ui): allow gauge to render as either light or dark
alexpaxton ee87046
fix(ui): ensure light mode of gauge is scoped to dashboard cells and …
alexpaxton 5899b22
feat(ui): refactor table graphs to conditionally render light mode
alexpaxton 3024d56
feat(ui): enable Heatmap graphs to render in light mode
alexpaxton d1e2c7b
feat(ui): enable histograms to render in light mode
alexpaxton 98b37fb
feat(ui): enable scatterplots to render in light mode
alexpaxton c835454
fix(ui): remove console log
alexpaxton 3236b83
fix(ui): update test
alexpaxton 476c6e3
refactor: calc theme state
121watts a689859
fix: type
121watts 19b0f41
refactor: fix action types
121watts 7878bdc
chore: remove dead code
121watts 8650db5
refactor(ui): rename props from "lightMode" to "theme"
alexpaxton 7100d23
Merge branch 'feat/light-mode-dashboards' of github.com:influxdata/in…
alexpaxton 4b3d201
refactor(ui): make variables control bar respond to theme
alexpaxton a1a1854
fix(ui): update mockState to match current appState shape
alexpaxton 5038ec2
fix(ui): update affected tests
alexpaxton 4c2e1b5
chore: Merge branch 'master' into feat/light-mode-dashboards
alexpaxton 1303234
refactor(theme): remove currentPage from localStorage
121watts 927863c
chore(ui): update changelog
alexpaxton ded6c4f
Merge branch 'feat/light-mode-dashboards' of github.com:influxdata/in…
alexpaxton 345ed0c
Merge branch 'master' into feat/light-mode-dashboards
alexpaxton a32df78
fix(ui): update test
alexpaxton be16888
Merge branch 'feat/light-mode-dashboards' of github.com:influxdata/in…
alexpaxton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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) |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused why we have a separate state for determining the current page- isn't it available via router path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@121watts I talked to @ebb-tide about our approach here a bit, and we concluded that it's unnecessary to have
currentPage
stored in persisted state. What do you think about moving it toephemeral
or somewhere else?