Add onClick prop for the logo
Toward LLK/scratch-www#2296 This allows us to take you to any destination when clicking the logo, or to do something else, or nothing at all. If no handler is provided, the logo will not be clickable.
This commit is contained in:
1 parent
9c736fa8ac
commit
de9bda94dc
4 files changed
+22
-8
No files matched your search
@@ -96,6 +96,7 @@ const GUIComponent = props => {
|
||||
onActivateCostumesTab,
|
||||
onActivateSoundsTab,
|
||||
onActivateTab,
|
||||
onClickLogo,
|
||||
onExtensionButtonClick,
|
||||
onRequestCloseBackdropLibrary,
|
||||
onRequestCloseCostumeLibrary,
|
||||
@@ -205,6 +206,7 @@ const GUIComponent = props => {
|
||||
renderLogin={renderLogin}
|
||||
showComingSoon={showComingSoon}
|
||||
onClickAccountNav={onClickAccountNav}
|
||||
onClickLogo={onClickLogo}
|
||||
onCloseAccountNav={onCloseAccountNav}
|
||||
onLogOut={onLogOut}
|
||||
onOpenRegistration={onOpenRegistration}
|
||||
@@ -370,6 +372,7 @@ GUIComponent.propTypes = {
|
||||
onActivateSoundsTab: PropTypes.func,
|
||||
onActivateTab: PropTypes.func,
|
||||
onClickAccountNav: PropTypes.func,
|
||||
onClickLogo: PropTypes.func,
|
||||
onCloseAccountNav: PropTypes.func,
|
||||
onExtensionButtonClick: PropTypes.func,
|
||||
onLogOut: PropTypes.func,
|
||||
|
||||
@@ -45,6 +45,10 @@
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.scratch-logo.clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.language-icon {
|
||||
height: 1.5rem;
|
||||
vertical-align: middle;
|
||||
|
||||
@@ -298,14 +298,15 @@ class MenuBar extends React.Component {
|
||||
<div className={styles.mainMenu}>
|
||||
<div className={styles.fileGroup}>
|
||||
<div className={classNames(styles.menuBarItem)}>
|
||||
<a href="https://scratch.mit.edu">
|
||||
<img
|
||||
alt="Scratch"
|
||||
className={styles.scratchLogo}
|
||||
draggable={false}
|
||||
src={scratchLogo}
|
||||
/>
|
||||
</a>
|
||||
<img
|
||||
alt="Scratch"
|
||||
className={classNames(styles.scratchLogo, {
|
||||
[styles.clickable]: typeof this.props.onClickLogo !== 'undefined'
|
||||
})}
|
||||
draggable={false}
|
||||
src={scratchLogo}
|
||||
onClick={this.props.onClickLogo}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className={classNames(styles.menuBarItem, styles.hoverable, styles.languageMenu)}
|
||||
@@ -715,6 +716,7 @@ MenuBar.propTypes = {
|
||||
onClickFile: PropTypes.func,
|
||||
onClickLanguage: PropTypes.func,
|
||||
onClickLogin: PropTypes.func,
|
||||
onClickLogo: PropTypes.func,
|
||||
onClickNew: PropTypes.func,
|
||||
onClickRemix: PropTypes.func,
|
||||
onClickSave: PropTypes.func,
|
||||
|
||||
@@ -7,6 +7,10 @@ import GUI from '../containers/gui.jsx';
|
||||
import HashParserHOC from '../lib/hash-parser-hoc.jsx';
|
||||
import TitledHOC from '../lib/titled-hoc.jsx';
|
||||
|
||||
const onClickLogo = () => {
|
||||
window.location = 'https://scratch.mit.edu';
|
||||
};
|
||||
|
||||
/*
|
||||
* Render the GUI playground. This is a separate function because importing anything
|
||||
* that instantiates the VM causes unsupported browsers to crash
|
||||
@@ -40,6 +44,7 @@ export default appTarget => {
|
||||
showPreviewInfo
|
||||
backpackHost={backpackHost}
|
||||
canSave={false}
|
||||
onClickLogo={onClickLogo}
|
||||
/>,
|
||||
appTarget);
|
||||
};
|
||||
Reference in new issue
Block a user