Skip to content
Snippets Groups Projects
Commit e97e5aa9 authored by Ben Wheeler's avatar Ben Wheeler
Browse files

removed save and save copy from beta; better menu section style handling

parent fc1e1cce
Branches
Tags
No related merge requests found
......@@ -337,37 +337,25 @@ class MenuBar extends React.Component {
place={this.props.isRtl ? 'left' : 'right'}
onRequestClose={this.props.onRequestCloseFile}
>
<MenuItem
isRtl={this.props.isRtl}
onClick={this.handleClickNew}
>
{newProjectMessage}
</MenuItem>
<MenuSection>
<MenuItem
isRtl={this.props.isRtl}
onClick={this.handleClickNew}
>
{newProjectMessage}
</MenuItem>
</MenuSection>
<MenuSection>
{this.props.canSave ? (
<MenuItem onClick={this.handleClickSave}>
{saveNowMessage}
</MenuItem>
) : (this.props.showComingSoon ? (
<MenuItemTooltip
id="save"
isRtl={this.props.isRtl}
>
<MenuItem>{saveNowMessage}</MenuItem>
</MenuItemTooltip>
) : [])}
) : []}
{this.props.canCreateCopy ? (
<MenuItem onClick={this.handleClickSaveAsCopy}>
{createCopyMessage}
</MenuItem>
) : (this.props.showComingSoon ? (
<MenuItemTooltip
id="copy"
isRtl={this.props.isRtl}
>
<MenuItem>{createCopyMessage}</MenuItem>
</MenuItemTooltip>
) : [])}
) : []}
{this.props.canRemix ? (
<MenuItem onClick={this.handleClickRemix}>
{remixMessage}
......@@ -376,8 +364,9 @@ class MenuBar extends React.Component {
</MenuSection>
<MenuSection>
<SBFileUploader onUpdateProjectTitle={this.props.onUpdateProjectTitle}>
{(renderFileInput, loadProject) => (
{(className, renderFileInput, loadProject) => (
<MenuItem
className={className}
onClick={loadProject}
>
<FormattedMessage
......@@ -391,8 +380,9 @@ class MenuBar extends React.Component {
</MenuItem>
)}
</SBFileUploader>
<SB3Downloader>{downloadProject => (
<SB3Downloader>{(className, downloadProject) => (
<MenuItem
className={className}
onClick={this.handleCloseFileMenuAndThen(downloadProject)}
>
<FormattedMessage
......
......@@ -55,9 +55,10 @@ MenuItem.propTypes = {
const addDividerClassToFirstChild = (child, id) => (
React.cloneElement(child, {
className: classNames(child.className, {
[styles.menuSection]: id === 0
}),
className: classNames(
{[styles.menuSection]: id === 0},
child.className
),
key: id
})
);
......
......@@ -107,13 +107,14 @@ class SBFileUploader extends React.Component {
);
}
render () {
return this.props.children(this.renderFileInput, this.handleClick);
return this.props.children(this.props.className, this.renderFileInput, this.handleClick);
}
}
SBFileUploader.propTypes = {
canSave: PropTypes.bool, // eslint-disable-line react/no-unused-prop-types
children: PropTypes.func,
className: PropTypes.string,
intl: intlShape.isRequired,
loadingState: PropTypes.oneOf(LoadingStates),
onLoadingFinished: PropTypes.func,
......@@ -123,6 +124,9 @@ SBFileUploader.propTypes = {
loadProject: PropTypes.func
})
};
SBFileUploader.defaultProps = {
className: ''
};
const mapStateToProps = state => ({
loadingState: state.scratchGui.projectState.loadingState,
vm: state.scratchGui.vm
......
......@@ -52,6 +52,7 @@ class SB3Downloader extends React.Component {
children
} = this.props;
return children(
this.props.className,
this.downloadProject
);
}
......@@ -67,10 +68,14 @@ const getProjectFilename = (curTitle, defaultTitle) => {
SB3Downloader.propTypes = {
children: PropTypes.func,
className: PropTypes.string,
onSaveFinished: PropTypes.func,
projectFilename: PropTypes.string,
saveProjectSb3: PropTypes.func
};
SB3Downloader.defaultProps = {
className: ''
};
const mapStateToProps = state => ({
saveProjectSb3: state.scratchGui.vm.saveProjectSb3.bind(state.scratchGui.vm),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment