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

Update mobile nav to match new design #4706

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vanilla-framework",
"version": "3.12.1",
"version": "3.12.2",
"author": {
"email": "webteam@canonical.com",
"name": "Canonical Webteam"
Expand Down
98 changes: 93 additions & 5 deletions scss/_patterns_navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,33 @@ $spv-navigation-logo-bottom-position: 0.125rem; // 2px when 1rem is 16px
line-height: map-get($line-heights, default-text);
margin: 0;
overflow: hidden;
padding-left: calc(#{map-get($grid-margin-widths, small)} + #{$sph--x-large}); // allow navigation align with tag logo text on small screens
position: relative;
text-align: left;
text-overflow: ellipsis;
white-space: nowrap;
width: 100%;

@media (min-width: $threshold-4-6-col) {
padding-left: calc(#{map-get($grid-margin-widths, default)} + #{$sph--x-large});
}

@media (min-width: $breakpoint-navigation-threshold) {
padding-left: $sph--large;
}

&::before {
content: '';
height: 1px;
left: 0;
left: calc(#{map-get($grid-margin-widths, small)} + #{$sph--x-large}); // allow navigation separator align with tag logo text on small screens
position: absolute;
right: 0;
top: 0;

@media (min-width: $threshold-4-6-col) {
left: calc(#{map-get($grid-margin-widths, default)} + #{$sph--x-large});
}

@media (min-width: $breakpoint-navigation-threshold) {
content: none;
}
Expand Down Expand Up @@ -190,6 +203,16 @@ $spv-navigation-logo-bottom-position: 0.125rem; // 2px when 1rem is 16px
justify-content: space-between;
padding-right: 0;

.p-navigation__link {
// reser padding for navigation links in the navigation banner
pedoch marked this conversation as resolved.
Show resolved Hide resolved
@extend %navigation-link-responsive-padding-horizontal;
@extend %navigation-link-responsive-padding-vertical;

&::before {
pedoch marked this conversation as resolved.
Show resolved Hide resolved
content: none;
}
}

@media (min-width: $threshold-4-6-col) {
padding-left: map-get($grid-margin-widths, default);
padding-right: 0;
Expand Down Expand Up @@ -274,6 +297,29 @@ $spv-navigation-logo-bottom-position: 0.125rem; // 2px when 1rem is 16px
list-style: none;
margin: -1px 0 0 0;
padding: 0;
position: relative;

// add separator between navigation items
&::before {
pedoch marked this conversation as resolved.
Show resolved Hide resolved
content: '';
height: 1px;
left: calc(#{map-get($grid-margin-widths, small)} + #{$sph--x-large});
position: absolute;
right: 0;
top: 0;

@media (min-width: $threshold-4-6-col) {
left: calc(#{map-get($grid-margin-widths, default)} + #{$sph--x-large});
}

@media (min-width: $breakpoint-navigation-threshold) {
content: none;
}
}

&:first-child::before {
pedoch marked this conversation as resolved.
Show resolved Hide resolved
content: none;
}

@media (min-width: $breakpoint-navigation-threshold) {
display: flex;
Expand Down Expand Up @@ -301,6 +347,11 @@ $spv-navigation-logo-bottom-position: 0.125rem; // 2px when 1rem is 16px
flex-wrap: wrap;
margin-top: 0; // prevents bottom border of nav from moving 1px

// remove separtion for navigation items in the navigation banner
&::before {
content: none;
}

@media (min-width: $breakpoint-navigation-threshold) {
display: none;
}
Expand Down Expand Up @@ -544,6 +595,7 @@ $spv-navigation-logo-bottom-position: 0.125rem; // 2px when 1rem is 16px
right: map-get($grid-margin-widths, small);
text-indent: calc(100% + 10rem);
top: calc($spv--large + map-get($nudges, x-small));
transform: rotate(-90deg);
width: map-get($icon-sizes, default);

@media (min-width: $threshold-4-6-col) {
Expand All @@ -552,12 +604,17 @@ $spv-navigation-logo-bottom-position: 0.125rem; // 2px when 1rem is 16px

@media (min-width: $breakpoint-navigation-threshold) {
right: calc($sph--small + 1px); // 1px for the border on selects. this aligns it with any selects underneath
transform: rotate(0deg);
}
}

&.is-active {
&::after {
transform: rotate(180deg);
transform: rotate(0deg);

@media (min-width: $breakpoint-navigation-threshold) {
transform: rotate(180deg);
}
}

.p-navigation__dropdown,
Expand All @@ -570,18 +627,46 @@ $spv-navigation-logo-bottom-position: 0.125rem; // 2px when 1rem is 16px
// add padding to accommodate icon
padding-right: 2 * $sph--small + map-get($icon-sizes, default);
}

&:first-child .p-navigation__link::before {
content: none;
}
}

.p-navigation__dropdown-item {
@extend %navigation-link-responsive-padding-horizontal;
@extend %navigation-link-responsive-padding-vertical;

display: block;
padding-bottom: $spv--small;
padding-top: $spv--small;
padding-left: calc(#{map-get($grid-margin-widths, small)} + #{$sph--x-large}); // make dropdown items align with the tag logo text
position: relative;
white-space: nowrap;

// add separator line for dropdown items
&::before {
content: '';
height: 1px;
left: calc(#{map-get($grid-margin-widths, small)} + #{$sph--x-large});
position: absolute;
right: 0;
top: 0;

@media (min-width: $threshold-4-6-col) {
left: calc(#{map-get($grid-margin-widths, default)} + #{$sph--x-large});
}

@media (min-width: $breakpoint-navigation-threshold) {
content: none;
}
}

@media (min-width: $threshold-4-6-col) {
padding-left: calc(#{map-get($grid-margin-widths, default)} + #{$sph--x-large});
}

@media (min-width: $breakpoint-navigation-threshold) {
padding-bottom: $spv--medium;
padding-left: $sph--large;
padding-top: $spv--medium;
}

Expand Down Expand Up @@ -685,7 +770,10 @@ $spv-navigation-logo-bottom-position: 0.125rem; // 2px when 1rem is 16px
}
}

.p-navigation__nav .p-navigation__link::before {
// add color to separator line for navigation items, navigation links and dropdown items
.p-navigation__nav .p-navigation__link::before,
.p-navigation__nav .p-navigation__items::before,
.p-navigation__nav .p-navigation__items .p-navigation__dropdown-item::before {
background: $color-navigation-separator;
}

Expand Down