diff --git a/app/components/Breadcrumbs/index.jsx b/app/components/Breadcrumbs/index.jsx new file mode 100644 index 00000000..314a3310 --- /dev/null +++ b/app/components/Breadcrumbs/index.jsx @@ -0,0 +1,42 @@ +/* @flow weak */ +import React, { Component } from 'react' +import { connect } from 'react-redux' +import config from '../../config' + +let Breadcrumbs = ({currentPath}) => { + const pathComps = currentPath.split('/') + const rootCrumb = {path: '/', name: config.projectName, isDir: true} + const crumbs = pathComps.map((pathComp, idx, pathComps) => { + if (pathComp === '') return rootCrumb + return { + name: pathComp, + path: pathComps.slice(0, idx+1).join('/'), + isDir: (idx !== pathComps.length - 1) // last pathComp isDir === false + } + }, []) + + return ( +
+ {crumbs.map(crumb => )} +
+ ) +} +Breadcrumbs = connect(state => { + if (state.TabState.getActiveGroup() && state.TabState.getActiveGroup().activeTab) { + return {currentPath: state.TabState.getActiveGroup().activeTab.path || ''} + } else { + return {currentPath: ''} + } +})(Breadcrumbs) + +const SHOW_ICON = false +const Crumb = ({node}) => { + return ( +
+ {SHOW_ICON?:null} +
{node.name}
+
+ ) +} + +export default Breadcrumbs diff --git a/app/components/TopBar/index.jsx b/app/components/TopBar/index.jsx index e01bb342..a4137bde 100644 --- a/app/components/TopBar/index.jsx +++ b/app/components/TopBar/index.jsx @@ -1,12 +1,13 @@ /* @flow weak */ import React, { Component } from 'react' -import Menu from '../Menu' import MenuBar from '../MenuBar' +import Breadcrumbs from '../Breadcrumbs' const TopBar = () => { return (
+
) } diff --git a/app/containers/IDE.jsx b/app/containers/IDE.jsx index 43786dc8..9414113c 100644 --- a/app/containers/IDE.jsx +++ b/app/containers/IDE.jsx @@ -14,7 +14,7 @@ class IDE extends Component { super(props) } - componentDidMount () { + componentWillMount () { api.setupWorkspace().then(_config => { Object.assign(config, _config) }) diff --git a/app/styles/components/Breadcrumbs.styl b/app/styles/components/Breadcrumbs.styl new file mode 100644 index 00000000..dafd9c6c --- /dev/null +++ b/app/styles/components/Breadcrumbs.styl @@ -0,0 +1,42 @@ +$breadcrumbs-height = 24px; + +.breadcrumbs { + display: flex; + height: $breadcrumbs-height + 1px; + border-bottom: 1px solid transparent; +} + +.crumb-node-name { + line-height: $breadcrumbs-height; +} + +.crumb { + display: flex; + align-items: center; + padding-left: 10px; + padding-right: $breadcrumbs-height*0.25 + 10px; + position: relative; + + &:before, &:after { + display: block; + content: ''; + border-style: solid; + border-color: transparent; + border-right: none; + } + &:before { + absolute(right 0 top -1px) + border-top-width: $breadcrumbs-height*0.5 + 1px; + border-bottom-width: $breadcrumbs-height*0.5 + 1px; + border-left-width: $breadcrumbs-height*0.25 + 1px; + } + &:after { + absolute(right 1px top 0px) + border-top-width: $breadcrumbs-height*0.5 + border-bottom-width: $breadcrumbs-height*0.5 + border-left-width: $breadcrumbs-height*0.25; + } + &:last-child { + &:before, &:after {display: none} + } +} diff --git a/app/styles/components/Menu.styl b/app/styles/components/Menu.styl index ae8fea25..5283cbb5 100644 --- a/app/styles/components/Menu.styl +++ b/app/styles/components/Menu.styl @@ -85,47 +85,3 @@ position: fixed; z-index: z(context-menu); } - - -// MenuBar -.menu-bar { - display: flex; - background-color: #fafafa; - border-bottom: 1px solid transparent; -} - -.menu-bar-item { - position: relative; - > .menu { - border-top-left-radius: 0; - border-top-right-radius: 0; - } -} - -.menu-bar-item-container { - padding: 4px 12px; - position: relative; - height: 100%; - z-index: z(menu-bar-item-container); - &.active { - background-color: $menu-background-color-active; - color: #fff; - } -} - -.menu-bar-item.coding-logo { - align-self: stretch; - width: 36px; - - .menu-bar-item-container { - &:after { - codingMonkeyBackground; - absolute(0); - content: ' '; - } - &.active:after { - fill: #fff; - } - } -} - diff --git a/app/styles/components/MenuBar.styl b/app/styles/components/MenuBar.styl new file mode 100644 index 00000000..e4c69073 --- /dev/null +++ b/app/styles/components/MenuBar.styl @@ -0,0 +1,41 @@ +// MenuBar +.menu-bar { + display: flex; + background-color: #fafafa; + border-bottom: 1px solid transparent; +} + +.menu-bar-item { + position: relative; + > .menu { + border-top-left-radius: 0; + border-top-right-radius: 0; + } +} + +.menu-bar-item-container { + padding: 4px 12px; + position: relative; + height: 100%; + z-index: z(menu-bar-item-container); + &.active { + background-color: $menu-background-color-active; + color: #fff; + } +} + +.menu-bar-item.coding-logo { + align-self: stretch; + width: 36px; + + .menu-bar-item-container { + &:after { + codingMonkeyBackground; + absolute(0); + content: ' '; + } + &.active:after { + fill: #fff; + } + } +} diff --git a/app/styles/components/index.styl b/app/styles/components/index.styl index 4991d802..2fa945bd 100644 --- a/app/styles/components/index.styl +++ b/app/styles/components/index.styl @@ -1,4 +1,6 @@ @import "./Menu"; +@import "./MenuBar"; +@import "./Breadcrumbs"; @import "./PaneView"; @import "./TabView"; @import "./FileTree"; diff --git a/app/styles/mixins.styl b/app/styles/mixins.styl index ef9181f7..093f8431 100644 --- a/app/styles/mixins.styl +++ b/app/styles/mixins.styl @@ -82,3 +82,13 @@ margin-tb($margin) { margin-top: $margin; margin-bottom: $margin; } + +padding-lr($padding) { + padding-left: $padding; + padding-right: $padding; +} + +padding-tb($padding) { + padding-top: $padding; + padding-bottom: $padding; +} diff --git a/app/styles/themes/dark/styles/bars.styl b/app/styles/themes/dark/styles/bars.styl index f07fc448..4f80bc4f 100644 --- a/app/styles/themes/dark/styles/bars.styl +++ b/app/styles/themes/dark/styles/bars.styl @@ -7,3 +7,17 @@ .status-bar { border-color: $base-border-color; } + +.breadcrumbs { + background-color: $menu-background-color; + border-color: $base-border-color; + .crumb { + background-color: $menu-background-color; + &:before { + border-left-color: $base-border-color; + } + &:after { + border-left-color: $menu-background-color; + } + } +} diff --git a/app/styles/themes/light/styles/bars.styl b/app/styles/themes/light/styles/bars.styl index ea9b4ba9..1a3542f1 100644 --- a/app/styles/themes/light/styles/bars.styl +++ b/app/styles/themes/light/styles/bars.styl @@ -1,5 +1,5 @@ .menu-bar { - background-color: gray(100%); + background-color: $menu-background-color; border-color: $base-border-color; color: gray(15%); } @@ -7,3 +7,17 @@ .status-bar { border-color: $base-border-color; } + +.breadcrumbs { + background-color: $menu-background-color; + border-color: $base-border-color; + .crumb { + background-color: $menu-background-color; + &:before { + border-left-color: $base-border-color; + } + &:after { + border-left-color: $menu-background-color; + } + } +} diff --git a/app/styles/themes/light/styles/variables.styl b/app/styles/themes/light/styles/variables.styl index 34ff7f7a..0bdd0cbf 100644 --- a/app/styles/themes/light/styles/variables.styl +++ b/app/styles/themes/light/styles/variables.styl @@ -15,7 +15,7 @@ $base-border-color = darken($base-background-color, 8%); $panel-background-color = $base-background-color; $panel-border-color = $base-border-color; -$menu-background-color = $base-background-color; +$menu-background-color = white; // tabs $tab-bar-background-color = $base-background-color;