-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI Framework] Add functionality for hiding and showing the chrome wh…
…en viewing Sandboxes (#13475) (#13478) * Update UI Framework doc site with functionality for hiding and showing the chrome when viewing Sandboxes. (#13437) * Fix formatting in generator-kui templates. (#13443)
- Loading branch information
Showing
16 changed files
with
206 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import ActionTypes from './action_types'; | ||
|
||
export const openSandbox = () => ({ | ||
type: ActionTypes.OPEN_SANDBOX, | ||
}); | ||
|
||
export const closeSandbox = () => ({ | ||
type: ActionTypes.CLOSE_SANDBOX, | ||
}); |
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
60 changes: 54 additions & 6 deletions
60
ui_framework/doc_site/src/components/guide_sandbox/guide_sandbox.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 |
---|---|---|
@@ -1,7 +1,55 @@ | ||
import React from 'react'; | ||
import React, { | ||
Component, | ||
} from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { bindActionCreators } from 'redux'; | ||
import { connect } from 'react-redux'; | ||
|
||
export const GuideSandbox = props => ( | ||
<div className="guideSandbox"> | ||
{props.children} | ||
</div> | ||
); | ||
import { | ||
getIsSandbox, | ||
} from '../../store'; | ||
|
||
import { | ||
openSandbox, | ||
closeSandbox, | ||
} from '../../actions'; | ||
|
||
function mapStateToProps(state) { | ||
return { | ||
isSandbox: getIsSandbox(state), | ||
}; | ||
} | ||
|
||
function mapDispatchToProps(dispatch) { | ||
const actions = { | ||
openSandbox, | ||
closeSandbox, | ||
}; | ||
|
||
return bindActionCreators(actions, dispatch); | ||
} | ||
|
||
class GuideSandboxComponent extends Component { | ||
componentWillMount() { | ||
this.props.openSandbox(); | ||
} | ||
|
||
componentWillUnmount() { | ||
this.props.closeSandbox(); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className="guideSandbox"> | ||
{this.props.children} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
GuideSandboxComponent.propTypes = { | ||
openSandbox: PropTypes.func, | ||
closeSandbox: PropTypes.func, | ||
}; | ||
|
||
export const GuideSandbox = connect(mapStateToProps, mapDispatchToProps)(GuideSandboxComponent); |
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
26 changes: 26 additions & 0 deletions
26
ui_framework/doc_site/src/store/reducers/sandbox_reducer.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,26 @@ | ||
import ActionTypes from '../../actions/action_types'; | ||
|
||
const defaultState = { | ||
isSandbox: false, | ||
}; | ||
|
||
export default function sandboxReducer(state = defaultState, action) { | ||
switch (action.type) { | ||
case ActionTypes.OPEN_SANDBOX: { | ||
return Object.assign({}, state, { | ||
isSandbox: true, | ||
}); | ||
} | ||
|
||
case ActionTypes.CLOSE_SANDBOX: { | ||
return Object.assign({}, state, { | ||
isSandbox: false, | ||
}); | ||
} | ||
|
||
default: | ||
break; | ||
} | ||
|
||
return state; | ||
} |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
export { <%= componentName %> } from './<%= fileName %>'; | ||
export { | ||
<%= componentName %>, | ||
} from './<%= fileName %>'; |
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