diff --git a/components/page/page-style.scss b/components/page/page-style.scss index 1204ae059e61..a3527970855d 100644 --- a/components/page/page-style.scss +++ b/components/page/page-style.scss @@ -10,22 +10,19 @@ // XXX: Temporary hack to fix sidebar width .page > div:first-of-type { - flex: 0 0 auto; + display: none; position: relative; overflow: hidden; @include break { - flex:0 0 30%; - } - - @include break('large') { - flex:0 0 25%; + display: block; + flex: 0 0 280px; } } .page__content { + flex: 1 1 auto; overflow-x: hidden; - width: 100%; padding: 1.5em 1em; @media break { diff --git a/components/sidebar-item/sidebar-item-style.scss b/components/sidebar-item/sidebar-item-style.scss index 3600cb221898..00c930f1c9fb 100644 --- a/components/sidebar-item/sidebar-item-style.scss +++ b/components/sidebar-item/sidebar-item-style.scss @@ -3,81 +3,82 @@ .sidebar-item { position: relative; - font-size: getFontSize(-1); - margin-bottom: 0.75em; - - &__title { - padding-right: 15px; - font-weight: 400; - text-decoration: none; - color: inherit; - - &:hover { - color: $text-color-highlight; - } - } + display: flex; + flex-wrap: wrap; + font-size: 15px; + margin: 0.6em 0; &__toggle { - position: absolute; - right: 0; - line-height: 1.5; + flex: 0 0 auto; + margin-top: 0.125em; + margin-right: 0.5em; cursor: pointer; - color: getColor(dusty-grey); - transition: color 250ms; - margin-left: 1.5rem; + color: getColor(denim); + transition: all 250ms; &:hover { color: getColor(mine-shaft); } } + &__title { + flex: 1 1 auto; + font-weight: 600; + color: getColor(dove-grey); + } + &__anchors { - display:none; + position: relative; + display: none; + flex: 0 0 100%; + flex-wrap: wrap; + margin: 0.35em 0; + padding-left: 1.5em; + overflow: hidden; list-style: none; - padding: 0; - margin: 0.5em 0 1em; - } - &__version { - margin-bottom: 10px; + &:before { + content: ''; + position: absolute; + height: calc(100% - 0.6em); + top: 0; + left: 1.5em; + border-left: 1px dashed getColor(dusty-grey); + } } &__anchor { - margin:0.25em 0; + position: relative; + flex: 0 0 100%; + margin: 0.25em 0; + padding-left: 1em; + @include control-overflow; - a { - display: inline-block; - max-width: 100%; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - color: getColor(dusty-grey); + &:first-child { margin-top: 0; } + &:last-child { margin-bottom: 0; } + &:before { + content: ''; + position: absolute; + width: 0.5em; + left: 0; + top: 60%; + border-bottom: 1px dashed getColor(dusty-grey); + } - &:hover { - color: getColor(mine-shaft); - } + a { + color: getColor(emperor); + &:hover { color: getColor(denim); } } } &--open { .sidebar-item__anchors { - display:block; - } - - .sidebar-item__title { - color: $text-color-highlight; + display: flex; } .sidebar-item__toggle { - margin-left:-2px; - transform:rotate(180deg) translateX(1px); - } - } - - &--empty { - .sidebar-item__toggle, - .sidebar-item__anchors { - display: none; + transform-origin: center center; + transform: rotate(90deg); } } } diff --git a/components/sidebar-item/sidebar-item.jsx b/components/sidebar-item/sidebar-item.jsx index 54d7641fdd18..f1337710cdf1 100644 --- a/components/sidebar-item/sidebar-item.jsx +++ b/components/sidebar-item/sidebar-item.jsx @@ -1,51 +1,77 @@ import React from 'react'; import Link from '../link/link'; +const block = 'sidebar-item'; + export default class SidebarItem extends React.Component { constructor(props) { super(props); this.state = { - open: this.isOpen(props) + open: this._isOpen(props) }; } render() { - let { index, url, title, anchors = [], currentPage } = this.props; - - let emptyMod = !anchors.length ? 'sidebar-item--empty' : ''; - let openMod = (this.state.open) ? 'sidebar-item--open' : ''; - let anchorUrl = url + '#'; - let isCurrentPage = `/${currentPage}` === url; + let { title, anchors = [] } = this.props; + let openMod = this.state.open ? `${block}--open` : ''; return ( -