-
Notifications
You must be signed in to change notification settings - Fork 840
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add K6 overrides and more advanced theming system (#191)
Adds a more structured theming system to EUI. Docs are available in the wiki. As part of this we added new themes for K6 so that we could use EUI within Kibana.
- Loading branch information
Showing
29 changed files
with
337 additions
and
122 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import ActionTypes from './action_types'; | ||
|
||
export const toggleTheme = () => ({ | ||
export const toggleTheme = theme => ({ | ||
type: ActionTypes.TOGGLE_THEME, | ||
data: { | ||
theme, | ||
}, | ||
}); |
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
93 changes: 93 additions & 0 deletions
93
src-docs/src/components/guide_theme_selector/guide_theme_selector.js
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,93 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import { | ||
EuiButtonEmpty, | ||
EuiContextMenuItem, | ||
EuiContextMenuPanel, | ||
EuiPopover, | ||
} from '../../../../src/components'; | ||
|
||
export class GuideThemeSelector extends Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
isThemePopoverOpen: false, | ||
}; | ||
} | ||
|
||
onThemeButtonClick = () => { | ||
this.setState({ | ||
isThemePopoverOpen: !this.state.isThemePopoverOpen, | ||
}); | ||
}; | ||
|
||
closeThemePopover = () => { | ||
this.setState({ | ||
isThemePopoverOpen: false, | ||
}); | ||
}; | ||
|
||
render() { | ||
const themeButton = ( | ||
<EuiButtonEmpty | ||
size="s" | ||
color="text" | ||
iconType="arrowDown" | ||
iconSide="right" | ||
onClick={this.onThemeButtonClick} | ||
> | ||
Theme | ||
</EuiButtonEmpty> | ||
); | ||
|
||
const themeOptions = [{ | ||
name: 'Light', | ||
value: 'light', | ||
}, { | ||
name: 'Dark', | ||
value: 'dark', | ||
}, { | ||
name: 'K6', | ||
value: 'k6', | ||
}, { | ||
name: 'K6 dark', | ||
value: 'k6_dark', | ||
}].map(option => { | ||
const { name, value } = option; | ||
|
||
return ( | ||
<EuiContextMenuItem | ||
key={value} | ||
icon={value === this.props.selectedTheme ? 'check' : 'empty'} | ||
onClick={() => { this.closeThemePopover(); this.props.onToggleTheme(value); }} | ||
> | ||
{`${name}`} | ||
</EuiContextMenuItem> | ||
); | ||
}); | ||
|
||
return ( | ||
<EuiPopover | ||
id="pageChromeThemePopover" | ||
button={themeButton} | ||
isOpen={this.state.isThemePopoverOpen} | ||
closePopover={this.closeThemePopover} | ||
panelPaddingSize="none" | ||
withTitle | ||
anchorPosition="downRight" | ||
> | ||
<EuiContextMenuPanel | ||
style={{ width: '120px' }} | ||
items={themeOptions} | ||
/> | ||
</EuiPopover> | ||
); | ||
} | ||
} | ||
|
||
GuideThemeSelector.propTypes = { | ||
onToggleTheme: PropTypes.func.isRequired, | ||
selectedTheme: PropTypes.string.isRequired, | ||
}; |
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 @@ | ||
export { GuideThemeSelector } from './guide_theme_selector'; |
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,2 @@ | ||
@import "../../src/theme_k6_dark"; | ||
@import "./components/guide_components"; |
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,2 @@ | ||
@import "../../src/theme_k6_light"; | ||
@import "./components/guide_components"; |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// Core | ||
@import 'variables/index'; | ||
@import 'mixins/index'; | ||
@import 'reset/index'; |
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 |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
@import 'responsive'; | ||
@import 'shadow'; | ||
@import 'size'; | ||
@import 'typography'; | ||
@import 'helpers'; |
Oops, something went wrong.