Skip to content

Commit 27c546f

Browse files
committed
add button and functionality
1 parent b221687 commit 27c546f

File tree

3 files changed

+47
-5
lines changed

3 files changed

+47
-5
lines changed

client/common/icons.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ import Account from '../images/account.svg';
1818
import Code from '../images/code.svg';
1919
import Save from '../images/save.svg';
2020
import Terminal from '../images/terminal.svg';
21-
2221
import Folder from '../images/folder-padded.svg';
23-
2422
import CircleTerminal from '../images/circle-terminal.svg';
2523
import CircleFolder from '../images/circle-folder.svg';
2624
import CircleInfo from '../images/circle-info.svg';
25+
import Add from '../images/add.svg';
2726

2827
// HOC that adds the right web accessibility props
2928
// https://www.scottohara.me/blog/2019/05/22/contextual-images-svgs-and-a11y.html
@@ -94,9 +93,8 @@ export const MoreIcon = withLabel(More);
9493
export const TerminalIcon = withLabel(Terminal);
9594
export const CodeIcon = withLabel(Code);
9695
export const SaveIcon = withLabel(Save);
97-
9896
export const FolderIcon = withLabel(Folder);
99-
10097
export const CircleTerminalIcon = withLabel(CircleTerminal);
10198
export const CircleFolderIcon = withLabel(CircleFolder);
10299
export const CircleInfoIcon = withLabel(CircleInfo);
100+
export const AddIcon = withLabel(Add);

client/images/add.svg

Lines changed: 3 additions & 0 deletions
Loading

client/modules/IDE/components/Header/MobileNav.jsx

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ import NavMenuItem from '../../../../components/Nav/NavMenuItem';
1313
import { prop, remSize } from '../../../../theme';
1414
import AsteriskIcon from '../../../../images/p5-asterisk.svg';
1515
import IconButton from '../../../../components/mobile/IconButton';
16-
import { AccountIcon, EditorIcon, MoreIcon } from '../../../../common/icons';
16+
import {
17+
AccountIcon,
18+
AddIcon,
19+
EditorIcon,
20+
MoreIcon
21+
} from '../../../../common/icons';
1722
import {
1823
newFile,
1924
newFolder,
@@ -29,6 +34,7 @@ import { showToast } from '../../actions/toast';
2934
import { setLanguage } from '../../actions/preferences';
3035
import Overlay from '../../../App/components/Overlay';
3136
import ProjectName from './ProjectName';
37+
import CollectionCreate from '../../../User/components/CollectionCreate';
3238

3339
const Nav = styled(NavBar)`
3440
background: ${prop('MobilePanel.default.background')};
@@ -238,6 +244,7 @@ const MobileNav = () => {
238244
)}
239245
</Title>
240246
<Options>
247+
{title === 'My Stuff' && <StuffMenu />}
241248
{user.authenticated ? (
242249
<AccountMenu />
243250
) : (
@@ -261,6 +268,40 @@ const MobileNav = () => {
261268
);
262269
};
263270

271+
const StuffMenu = () => {
272+
const dispatch = useDispatch();
273+
const { isOpen, handlers } = useMenuProps('stuff');
274+
const { newSketch } = useSketchActions();
275+
276+
const [createCollectionVisible, setCreateCollectionVisible] = useState(false);
277+
278+
const { t } = useTranslation();
279+
280+
return (
281+
<div>
282+
<IconButton icon={AddIcon} {...handlers} />
283+
<ul className={isOpen ? 'opened' : ''}>
284+
<ParentMenuContext.Provider value="stuff">
285+
<NavMenuItem onClick={() => newSketch()}>
286+
{t('DashboardView.NewSketch')}
287+
</NavMenuItem>
288+
<NavMenuItem onClick={() => setCreateCollectionVisible(true)}>
289+
{t('DashboardView.CreateCollection')}
290+
</NavMenuItem>
291+
</ParentMenuContext.Provider>
292+
</ul>
293+
{createCollectionVisible && (
294+
<Overlay
295+
title={t('DashboardView.CreateCollectionOverlay')}
296+
closeOverlay={() => setCreateCollectionVisible(false)}
297+
>
298+
<CollectionCreate />
299+
</Overlay>
300+
)}
301+
</div>
302+
);
303+
};
304+
264305
const AccountMenu = () => {
265306
const user = useSelector((state) => state.user);
266307
const dispatch = useDispatch();

0 commit comments

Comments
 (0)