Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converts Nav component into modular css #1089

Merged
merged 7 commits into from
Feb 27, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
304 changes: 150 additions & 154 deletions packages/office-ui-fabric-react/src/components/Nav/Nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,196 +5,192 @@ $hasExpandButtonLinkLeftPadding: 28px;
$noExpandButtonLinkLeftPadding: 20px;
$linkRightPadding: 20px;

:global {
.root {
overflow-y: auto;
-webkit-overflow-scrolling: touch;
user-select: none;
}

.ms-Nav {
overflow-y: auto;
-webkit-overflow-scrolling: touch;
user-select: none;
}
.rootIsOnTop {
position: absolute;
}

.ms-Nav.is-onTop {
position: absolute;
}
.navItems {
list-style-type: none;
}

.ms-Nav ul {
list-style-type: none;
}

.ms-Nav ul,
.ms-Nav ul > li {
padding: 0;
}
.navItems,
.navItems > .navItem {
padding: 0;
}

.ms-Nav-groupContent {
display: none;
margin-bottom: 40px;
}

.ms-Nav-group.is-expanded .ms-Nav-groupContent {
display: block;
}

.ms-Nav-Icon {
padding: 0px;
color: $selectedForegroundColor;
background: $selectedBackgroundColor;
transition: transform .1s linear;
}
.groupContent {
display: none;
margin-bottom: 40px;
}

.ms-Nav-IconLink {
@include margin-right(4px);
}
.group.groupIsExpanded .groupContent {
display: block;
}

.ms-Nav-chevronButton {
display: block;
.icon {
padding: 0px;
color: $selectedForegroundColor;
background: $selectedBackgroundColor;
transition: transform .1s linear;
}

font-weight: $ms-font-weight-regular;
font-size: $ms-font-size-s;
.iconLink {
@include margin-right(4px);
}

@include text-align(left);
line-height: $navnode-height;
margin: 5px 0;
@include padding(0px, $linkRightPadding, 0px, $hasExpandButtonLinkLeftPadding);
background: none;
border: none;
.chevronButton {
display: block;

text-transform: uppercase;
cursor: pointer;
font-weight: $ms-font-weight-regular;
font-size: $ms-font-size-s;

color: $unselectedForegroundColor;
background: $unselectedBackgroundColor;
@include text-align(left);
line-height: $navnode-height;
margin: 5px 0;
@include padding(0px, $linkRightPadding, 0px, $hasExpandButtonLinkLeftPadding);
background: none;
border: none;

&:visited {
color: inherit;
}
text-transform: uppercase;
cursor: pointer;

&:hover {
color: $unselectedHoverForegroundColor;
background: $unselectedHoverBackgroundColor;
}
color: $unselectedForegroundColor;
background: $unselectedBackgroundColor;

&.ms-Nav-chevronButton--group {
width: 100%;
height: $navnode-height;
border-bottom: 1px solid $dividerColor;
}
&:visited {
color: inherit;
}

.ms-Nav-chevron.ms-Icon {
position: absolute;
@include left(8px);
height: $navnode-height;
line-height: $navnode-height;
font-size: 12px;
transition: transform .1s linear;
&:hover {
color: $unselectedHoverForegroundColor;
background: $unselectedHoverBackgroundColor;
}

.ms-Nav-group.is-expanded .ms-Nav-chevronButton--group .ms-Nav-chevron {
transform: rotate(-180deg);
&.chevronButtonIsGroup {
width: 100%;
height: $navnode-height;
border-bottom: 1px solid $dividerColor;
}
}

.ms-Nav-linkText {
vertical-align: middle;
}
.chevronIcon {
position: absolute;
@include left(8px);
height: $navnode-height;
line-height: $navnode-height;
font-size: 12px;
transition: transform .1s linear;
}

.ms-Nav-compositeLink {
display: block;
position: relative;

.ms-Nav-chevronButton.ms-Nav-chevronButton--link {
display: block;
width: $hasExpandButtonLinkLeftPadding;
height: $navnode-height;
position: absolute;
top: 0;
@include left(0);
z-index: 1;
padding: 0;
margin: 0;

.ms-Nav-chevron {
position: relative;
}
}
.chevronIsExpanded {
transform: rotate(-180deg);
}

& a {
color: $unselectedForegroundColor;
}
color: $unselectedForegroundColor;
background: $unselectedBackgroundColor;
.linkText {
vertical-align: middle;
}

&:hover {
.compositeLink {
display: block;
position: relative;

& a,
& .ms-Nav-chevronButton {
background: $unselectedHoverBackgroundColor;
color: $unselectedHoverForegroundColor;
}
}
.chevronButton .chevronButtonLink {
display: block;
width: $hasExpandButtonLinkLeftPadding;
height: $navnode-height;
position: absolute;
top: 0;
@include left(0);
z-index: 1;
padding: 0;
margin: 0;

&.is-expanded {
.ms-Nav-chevron {
transform: rotate(-180deg);
}
.chevron {
position: relative;
}
}

&.is-selected {
& a,
& .ms-Nav-chevronButton {

color: $ms-color-themePrimary;
background: $selectedBackgroundColor;
& a {
color: $unselectedForegroundColor;
}
color: $unselectedForegroundColor;
background: $unselectedBackgroundColor;

&:after {
@include border-left(2px, solid, $ms-color-themePrimary);
&:hover {

content: '';
position: absolute;
top: 0;
@include right(0);
bottom: 0;
@include left(0);
}
}
& a,
& .chevronButton {
background: $unselectedHoverBackgroundColor;
color: $unselectedHoverForegroundColor;
}
}

.ms-Nav-link {
display: block;
position: relative;
height: $navnode-height;
line-height: $navnode-height;
text-decoration: none;
padding: 0 20px;
cursor: pointer;
text-overflow: ellipsis;
text-decoration: none;
white-space: nowrap;
overflow: hidden;
&.compositeLinkIsExpanded {
.chevron {
transform: rotate(-180deg);
}
}

.ms-Nav-groupHeaderFontSize {
@include ms-font-l;
}
&.compositeLinkIsSelected {
& a,
& .chevronButton {

.ms-Nav-chevronButton,
.ms-Nav-chevronButton--group,
.ms-Nav-chevronButton--link,
.ms-Nav-link {
@include focus-border();
}

.ms-Nav-linkButton.ms-Button--command {
@include padding-left($noExpandButtonLinkLeftPadding);
.ms-Button-label {
@include ms-font-m;
color: $ms-color-themePrimary;
}
background: $selectedBackgroundColor;

&:after {
@include border-left(2px, solid, $ms-color-themePrimary);

&.isOnExpanded {
@include padding-left($hasExpandButtonLinkLeftPadding);
content: '';
position: absolute;
top: 0;
@include right(0);
bottom: 0;
@include left(0);
}
}
}

}

.link {
display: block;
position: relative;
height: $navnode-height;
line-height: $navnode-height;
text-decoration: none;
padding: 0 20px;
cursor: pointer;
text-overflow: ellipsis;
text-decoration: none;
white-space: nowrap;
overflow: hidden;
}

.groupHeaderFontSize {
@include ms-font-l;
}

.chevronButton,
.chevronButtonGroup,
.chevronButtonLink,
.link {
@include focus-border();
}

:global(.ms-Nav-LinkButton.ms-Button--command) {
@include padding-left($noExpandButtonLinkLeftPadding);
:global(.ms-Button-label) {
@include ms-font-m;
color: $ms-color-themePrimary;
}

&.isOnExpanded {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For CSS classes outside of modules we should use the old naming convention: .is-onExpanded. And in this case the class is applied if it has an expand button, so maybe .has-expandButton.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no!!! No dashes in variable names.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, this class is in the :global() scope. GitHub just isn't showing it clearly in the snippet above. 😄

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wait... this is funky business! It's styling every global button!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fixed it.

@include padding-left($hasExpandButtonLinkLeftPadding);
}
}
Loading