Commit c657c43f authored by chris's avatar chris

menubars in progress

parent 7d3c8d8b
const filtered = (menu, menuItems) =>
Object.keys(menu)
.filter(key => menuItems.includes(key))
.reduce((obj, key) => {
obj[key] = menu[key];
return obj;
}, {});
const setMenuItems = (allMenuItems, menuItems) => {
if (menuItems.length === 0) return allMenuItems;
return filtered(allMenuItems, menuItems);
};
export { setMenuItems };
import React from "react";
import styled from "styled-components";
import { forEach, map } from "lodash";
import { map } from "lodash";
import MainMenuBarItems from "./MainMenuBarItems";
import { setMenuItems } from "../helpers";
const MainMenuContainer = styled.div`
background: #fff;
......@@ -30,31 +31,7 @@ const MainMenu = styled.div`
background: transparent;
`;
const filtered = (menu, menuItems) =>
Object.keys(menu)
.filter(key => menuItems.includes(key))
.reduce((obj, key) => {
obj[key] = menu[key];
return obj;
}, {});
const setMenuItems = (menu, menuItems) => {
let items = menuItems;
if (menuItems.length === 0) {
forEach(menu, (key, index) => {
items.push(index);
});
}
return filtered(menu, items);
};
const MainMenuBar = ({
menuItems = [],
children,
view,
className,
fileUpload
}) => (
const MainMenuBar = ({ menuItems = [], view, className, fileUpload }) => (
<MainMenuContainer>
<MainMenuInner>
<MainMenu>
......
import React from "react";
import styled from "styled-components";
import { forEach, map } from "lodash";
import { map } from "lodash";
import SideMenuItems from "./SideMenuItems";
import { setMenuItems } from "../helpers";
const SideMenuContainer = styled.div`
display: flex;
......@@ -22,43 +23,19 @@ const SideMenu = styled.div`
margin-top: 15px;
button {
display: flex;
margin-left: 5%;
flex-direction: column;
font-family: ${props => props.theme.fontInterface};
margin-left: 5%;
width: 90%;
background: transparent;
}
`;
const filtered = (menu, menuItems) =>
Object.keys(menu)
.filter(key => menuItems.includes(key))
.reduce((obj, key) => {
obj[key] = menu[key];
return obj;
}, {});
const setMenuItems = (menu, menuItems) => {
let items = menuItems;
if (menuItems.length === 0) {
forEach(menu, (key, index) => {
items.push(index);
});
}
return filtered(menu, items);
};
const SideMenuBar = ({
menuItems = [],
children,
view,
className,
fileUpload
}) => (
const SideMenuBar = ({ menuItems = [], view, className }) => (
<SideMenuContainer>
<SideMenuInner>
<SideMenu>
{map(setMenuItems(SideMenuItems, menuItems), item =>
item.menu({ view, item, fileUpload })
item.menu({ view, item })
)}
</SideMenu>
</SideMenuInner>
......
......@@ -17,6 +17,7 @@ export default {
title: {
title: "Change to Title",
content: "Title",
group: "",
enable: state => {
return setBlockType(state.config.schema.nodes.title)(state);
},
......@@ -30,6 +31,7 @@ export default {
subtitle: {
title: "Change to Subtilte",
content: "Subtilte",
group: "",
enable: state => {
return setBlockType(state.config.schema.nodes.subtitle)(state);
},
......@@ -42,6 +44,7 @@ export default {
author: {
title: "Change to Author",
content: "Author",
group: "",
enable: state => {
return setBlockType(state.config.schema.nodes.author)(state);
},
......@@ -54,6 +57,7 @@ export default {
epigraphPoetry: {
title: "Change to Epigraph Poetry",
content: "Epigraph Poetry",
group: "",
enable: state => {
return setBlockType(state.config.schema.nodes.epigraphPoetry)(state);
},
......@@ -66,6 +70,7 @@ export default {
epigraphProse: {
title: "Change to Epigraph Prose",
content: "Epigraph Prose",
group: "",
enable: state => {
return setBlockType(state.config.schema.nodes.epigraphProse)(state);
},
......@@ -77,8 +82,8 @@ export default {
},
plain: {
title: "Change to General Text",
// content: icons.paragraph,
content: "General Text",
group: "",
enable: state => {
return setBlockType(state.config.schema.nodes.paragraph)(state);
},
......@@ -92,6 +97,7 @@ export default {
heading1: {
title: "Change to heading level 1",
content: "Heading 1",
group: "",
enable: state => {
return setBlockType(state.config.schema.nodes.heading, {
level: 1,
......@@ -110,6 +116,7 @@ export default {
heading2: {
title: "Change to heading level 2",
content: "Heading 2",
group: "",
enable: state => {
return setBlockType(state.config.schema.nodes.heading, {
level: 2,
......@@ -128,6 +135,7 @@ export default {
heading3: {
title: "Change to heading level 3",
content: "Heading 3",
group: "",
enable: state => {
return setBlockType(state.config.schema.nodes.heading, {
level: 3,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment