Skip to content

Commit

Permalink
Navigation: Updated styling and some reorganization (tbd.)
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlo Bernardini committed Feb 19, 2019
1 parent e4f91d6 commit 063f9ff
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 39 deletions.
5 changes: 5 additions & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<style>
@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,600|Titillium+Web:400,600');

body {
font-family: var(--font-family-primary);
font-size: var(--font-size-normal);
}
</style>
6 changes: 1 addition & 5 deletions src/components/Navigation/NavBar.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import '../../themes/oneui/oneui.scss';

.NavBar {
background-color: var(--color-neutral);
background-color: var(--color-neutral-10);
color: var(--color-brand);
width: 100%;
height: var(--navigation-height);
Expand All @@ -18,8 +18,4 @@
align-items: flex-start;
align-content: center;
}

a {
text-decoration: none;
}
}
20 changes: 0 additions & 20 deletions src/components/Navigation/NavItem.scss

This file was deleted.

File renamed without changes.
36 changes: 36 additions & 0 deletions src/components/Navigation/NavItem/NavItem.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@import '../../../themes/oneui/oneui.scss';

.NavItem {
color: var(--link-color-normal);
display: flex;
align-items: center;
height: 100%;
font: {
size: var(--font-size-large);
weight: var(--font-weight-bold);
}
box-sizing: border-box;
padding: 0 var(--spacing-5x);
transition: all var(--transition-duration);
text-decoration: none;

&:hover {
color: var(--link-color-hover);
box-shadow: inset 0 -3px 0 var(--color-neutral-25);
}

&__active,
&--active {
color: var(--color-foreground);
box-shadow: inset 0 -3px 0 var(--color-primary);

&:hover {
color: var(--color-foreground);
box-shadow: inset 0 -3px 0 var(--color-primary-40);
}
}

&--pullRight {
margin-left: auto;
}
}
1 change: 1 addition & 0 deletions src/components/Navigation/NavItem/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './NavItem';
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { NavLink } from 'react-router-dom';
import PropTypes from 'prop-types';
import bem from 'bem';
import styles from './NavItem.scss';
import styles from '../NavItem/NavItem.scss';

const { block, elem } = bem({
name: 'NavItem',
Expand Down
1 change: 1 addition & 0 deletions src/components/Navigation/NavLinkItem/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './NavLinkItem';
4 changes: 1 addition & 3 deletions src/components/Navigation/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export { default as NavBar } from './NavBar';
export { default as NavItem } from './NavItem';
export { default as NavLinkItem } from './NavLinkItem';
export { default } from './NavBar';
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export { default as Heading } from './components/Heading';
export { default as Input } from './components/Input';
export { default as Link } from './components/Link';
export { default as LoadingSpinner } from './components/LoadingSpinner';
export * from './components/Navigation';
export { default as NavItem } from './components/Navigation/NavItem';
export { default as NavLinkItem } from './components/Navigation/NavLinkItem';
export { default as NavBar } from './components/Navigation';
export { default as ProgressBar } from './components/ProgressBar';
export { default as RadioButton } from './components/RadioButton';
export { default as Tab } from './components/Tabs/Tab';
Expand Down
2 changes: 1 addition & 1 deletion src/themes/oneui/base-variables/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ $color-bad: #F42534 !default;
warning: $color-warning,
bad: $color-bad
) {
@each $factor in (20, 50) {
@each $factor in (20, 50, 80) {
--color-#{ $context }-#{ 50 - ($factor / 2) }: #{ mix($color-background, $value, $factor) };
--color-#{ $context }-#{ 50 + ($factor / 2) }: #{ mix($color-foreground, $value, $factor) };
}
Expand Down
16 changes: 8 additions & 8 deletions stories/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ storiesOf('Navigation', module)
<NavBar>
<NavItem href="/">Home</NavItem>
<NavItem href="/" active={boolean('active', true)}>
Else
Another item
</NavItem>
<NavItem href="/" pullRight={boolean('pullRight', true)}>
On the right
Item on the right
</NavItem>
<NavItem href="/">Other</NavItem>
<NavItem href="/">Yet another item</NavItem>
</NavBar>
))
.add('react navigation', () => (
.add('With React Router', () => (
<BrowserRouter>
<NavBar>
<NavLinkItem exact to="/">
Home
</NavLinkItem>
<NavLinkItem to="/">Else</NavLinkItem>
<NavLinkItem to="/right" pullRight={boolean('pullRight', true)}>
On the right
<NavLinkItem to="/another">Another item</NavLinkItem>
<NavLinkItem to="/on-right" pullRight={boolean('pullRight', true)}>
Item on the right
</NavLinkItem>
<NavLinkItem to="/else">Other</NavLinkItem>
<NavLinkItem to="/yet-another">Yet another item</NavLinkItem>
</NavBar>
</BrowserRouter>
));

0 comments on commit 063f9ff

Please sign in to comment.