Skip to content

Localnav & Navigator UI changes and refactors #772

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

Merged
merged 57 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
c7fd3cf
[rdar://116401230] feat: working on UI changes
marinaaisa Nov 14, 2023
15d26fb
[rdar://116401230] feat: increase font size
marinaaisa Nov 14, 2023
db3df7a
[rdar://116401230] fix: active mode doesn’t reach the whole width
marinaaisa Nov 14, 2023
eeddb55
[rdar://116401230] fix: focus states
marinaaisa Nov 20, 2023
1b23dd0
[rdar://116401230] fix: mobile navigator head
marinaaisa Nov 20, 2023
47f2991
[rdar://116401230] test: fix tests
marinaaisa Nov 21, 2023
c0766f1
[rdar://116401230] feat: add above-navigator-head slot
marinaaisa Nov 21, 2023
fddefdd
[rdar://116401230] feat: allows to hide the navigator head on large v…
marinaaisa Nov 22, 2023
87961e8
[rdar://116401230] fix: loading navigation
marinaaisa Nov 22, 2023
dbf5217
[rdar://116401230] fix: slash on HierarchyItem
marinaaisa Nov 29, 2023
7deba6a
[rdar://116401230] fix: navigator alignment
marinaaisa Dec 1, 2023
48ea057
[rdar://116401230] test: fix tests
marinaaisa Jan 2, 2024
6670b77
Merge branch 'main' into r116401230/localnav-ui-updates
marinaaisa Jan 2, 2024
788a426
[rdar://116401230] test: add test for #above-navigator-head slot
marinaaisa Jan 2, 2024
e4a2fef
[rdar://116401230] fix: alignment in localnav
marinaaisa Jan 3, 2024
f189ed8
[rdar://116401230] fix: improve HierarchyItems
marinaaisa Jan 5, 2024
fa617e8
[rdar://116401230] fix: font styles
marinaaisa Jan 5, 2024
188841a
[rdar://116401230] fix: localnav background
marinaaisa Jan 8, 2024
d96594b
[rdar://116401230] fix: Hierarchy alignment on mobile
marinaaisa Jan 8, 2024
437d755
[rdar://116401230] fix: address feedback
marinaaisa Jan 9, 2024
3c18396
[rdar://116401230] refactor: move components inside Hero folder
marinaaisa Jan 10, 2024
590efcb
[rdar://116401230] fix: hierarchy styles
marinaaisa Jan 12, 2024
606131a
[rdar://116401230] fix: hierarchy colors
marinaaisa Jan 18, 2024
b84871e
[rdar://116401230] chore: delete rootLink from hierarchy
marinaaisa Jan 22, 2024
27b98f3
[rdar://116401230] fix: only show Hierarchy in hero when enableMinimi…
marinaaisa Jan 25, 2024
f7bed75
[rdar://116401230] feat: mobile viewport
marinaaisa Jan 26, 2024
7c68aed
[rdar://116401230] fix: adjust safe-area in mobile
marinaaisa Jan 26, 2024
a62fcda
[rdar://116401230] fix: address aligment feedback for Tutorials
marinaaisa Jan 30, 2024
d820d42
[rdar://116401230] chore: hide hierarchy in mobile viewport
marinaaisa Jan 31, 2024
4d05719
[rdar://116401230] fix: does not render a Hierarchy in IDE mode
marinaaisa Feb 5, 2024
0d932d5
[rdar://116401230] fix: it uses referencesProvider in Hierarchy inste…
marinaaisa Feb 5, 2024
f0813f1
[rdar://116401230] fix: delete currentTopicTags prop
marinaaisa Feb 5, 2024
88538f3
[rdar://116401230] fix: firstItemSlice as a const
marinaaisa Feb 5, 2024
44bbbe1
[rdar://116401230] refactor: delete hideNavigatorHeadOnLarge and unne…
marinaaisa Feb 6, 2024
e6a1e6c
[rdar://116401230] refactor: delete unnecessary props for Documentati…
marinaaisa Feb 6, 2024
77e9ff7
[rdar://116401230] fix: comment for head-inner and tests for navigato…
marinaaisa Feb 6, 2024
988001f
Merge branch 'main' into r116401230/localnav-ui-updates
marinaaisa Feb 6, 2024
3dd75aa
[rdar://116401230] chore: update license headers
marinaaisa Feb 6, 2024
dff4ca5
[rdar://116401230] fix: address feedback
marinaaisa Feb 7, 2024
b43ab1f
[rdar://116401230] fix: (WIP) hierarchy in mobile
marinaaisa Feb 7, 2024
e7feccc
Merge branch 'main' into r116401230/localnav-ui-updates
hqhhuang Feb 7, 2024
4a1c80b
[rdar://116401230] fix: delete previousSiblingChildren
marinaaisa Feb 8, 2024
4e10a13
[rdar://116401230] fix: Hierarchy feedback
marinaaisa Feb 8, 2024
18a0af7
[rdar://116401230] fix: revert css property
marinaaisa Feb 8, 2024
5e14687
[rdar://116401230] fix: license headers
marinaaisa Feb 8, 2024
05c9fc3
[rdar://116401230] fix: Hierarchy
marinaaisa Feb 8, 2024
e4f2d9b
[rdar://116401230] fix: don't apply figure-blue color to nav-menu-link
marinaaisa Feb 8, 2024
34d4fdd
[rdar://116401230] refactor: use NavMenuLink for HierarchyCollapsedItems
marinaaisa Feb 9, 2024
3264898
[rdar://116401230] refactor: hierarchyItems has a default value
marinaaisa Feb 9, 2024
2fd3988
[rdar://116401230] fix: get height from parent element if it's displayed
marinaaisa Feb 9, 2024
1b17dd7
[rdar://116401230] chore: update nav-menu-setting color and font-weight
marinaaisa Feb 12, 2024
67b26a0
[rdar://116401230] feat: emit navigate
marinaaisa Feb 13, 2024
4379e28
[rdar://116401230] fix: UI bug affecting the navigator height
marinaaisa Feb 13, 2024
edc6e18
[rdar://116401230] fix: hierarchy in parentTopicIdentifiers
marinaaisa Feb 13, 2024
29b7d4a
[rdar://116401230] fix: this..scroller
marinaaisa Feb 13, 2024
5772b74
Merge branch 'main' into r116401230/localnav-ui-updates
marinaaisa Feb 14, 2024
008569b
Merge branch 'main' into r116401230/localnav-ui-updates
marinaaisa Feb 14, 2024
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
18 changes: 16 additions & 2 deletions src/components/DocumentationTopic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@
<slot name="above-hero-content" />
</template>
<slot name="above-title" />
<Hierarchy
v-if="hierarchyItems.length && !enableMinimized"
:currentTopicTitle="title"
:isSymbolDeprecated="isSymbolDeprecated"
:isSymbolBeta="isSymbolBeta"
:parentTopicIdentifiers="hierarchyItems"
:currentTopicTags="tags"
/>
<LanguageSwitcher
v-if="shouldShowLanguageSwitcher"
:interfaceLanguage="interfaceLanguage"
Expand Down Expand Up @@ -172,7 +180,7 @@ import Aside from 'docc-render/components/ContentNode/Aside.vue';
import BetaLegalText from 'theme/components/DocumentationTopic/BetaLegalText.vue';
import LanguageSwitcher from 'theme/components/DocumentationTopic/Summary/LanguageSwitcher.vue';
import ViewMore from 'theme/components/DocumentationTopic/ViewMore.vue';
import DocumentationHero from 'docc-render/components/DocumentationTopic/DocumentationHero.vue';
import DocumentationHero from 'docc-render/components/DocumentationTopic/Hero/DocumentationHero.vue';
import WordBreak from 'docc-render/components/WordBreak.vue';
import { TopicSectionsStyle } from 'docc-render/constants/TopicSectionsStyle';
import OnThisPageNav from 'theme/components/OnThisPageNav.vue';
Expand All @@ -189,9 +197,10 @@ import Relationships from './DocumentationTopic/Relationships.vue';
import RequirementMetadata from './DocumentationTopic/Description/RequirementMetadata.vue';
import Availability from './DocumentationTopic/Summary/Availability.vue';
import SeeAlso from './DocumentationTopic/SeeAlso.vue';
import Title from './DocumentationTopic/Title.vue';
import Title from './DocumentationTopic/Hero/Title.vue';
import Topics from './DocumentationTopic/Topics.vue';
import OnThisPageStickyContainer from './DocumentationTopic/OnThisPageStickyContainer.vue';
import Hierarchy from './DocumentationTopic/Hero/Hierarchy.vue';

// size above which, the OnThisPage container is visible
const ON_THIS_PAGE_CONTAINER_BREAKPOINT = 1050;
Expand Down Expand Up @@ -236,6 +245,7 @@ export default {
Topics,
ViewMore,
WordBreak,
Hierarchy,
InlinePlusCircleIcon,
},
props: {
Expand Down Expand Up @@ -388,6 +398,10 @@ export default {
type: Array,
required: false,
},
hierarchyItems: {
type: Array,
default: () => ([]),
},
},
provide() {
// NOTE: this is not reactive: if this.identifier change, the provided value
Expand Down
154 changes: 21 additions & 133 deletions src/components/DocumentationTopic/DocumentationNav.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
This source file is part of the Swift.org open source project

Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception

See https://swift.org/LICENSE.txt for license information
Expand All @@ -12,7 +12,6 @@
<NavBase
:breakpoint="BreakpointName.medium"
:hasOverlay="false"
hasSolidBackground
:hasNoBorder="hasNoBorder"
:isDark="isDark"
isWideFormat
Expand All @@ -22,54 +21,27 @@
>
<template #pre-title="{ closeNav, isOpen, currentBreakpoint, className }" v-if="displaySidenav">
<div :class="className">
<transition name="sidenav-toggle">
<div
v-show="sidenavHiddenOnLarge"
class="sidenav-toggle-wrapper"
<div class="sidenav-toggle-wrapper">
<button
:aria-label="$t('navigator.open-navigator')"
:id="baseNavOpenSidenavButtonId"
class="sidenav-toggle"
:tabindex="isOpen ? -1 : null"
@click.prevent="handleSidenavToggle(closeNav, currentBreakpoint)"
>
<button
:aria-label="$t('navigator.open-navigator')"
:id="baseNavOpenSidenavButtonId"
class="sidenav-toggle"
:tabindex="isOpen ? -1 : null"
@click.prevent="handleSidenavToggle(closeNav, currentBreakpoint)"
>
<span class="sidenav-icon-wrapper">
<SidenavIcon class="icon-inline sidenav-icon" />
</span>
</button>
<span class="sidenav-toggle__separator" />
</div>
</transition>
<span class="sidenav-icon-wrapper">
<SidenavIcon class="icon-inline sidenav-icon" />
</span>
</button>
</div>
</div>
</template>
<template #default>
<slot
name="title"
v-bind="{ rootLink, linkClass: 'nav-title-link', inactiveClass: 'inactive' }"
>
<router-link
v-if="rootLink"
:to="rootLink"
class="nav-title-link"
>
{{ $t('documentation.title') }}
</router-link>
<span v-else class="nav-title-link inactive">{{ $t('documentation.title') }}</span>
</slot>
<slot name="title" />
</template>
<template #tray="{ closeNav }">
<Hierarchy
:currentTopicTitle="title"
:isSymbolDeprecated="isSymbolDeprecated"
:isSymbolBeta="isSymbolBeta"
:parentTopicIdentifiers="hierarchyItems"
:currentTopicTags="currentTopicTags"
:references="references"
/>
<NavMenuItems
class="nav-menu-settings"
:previousSiblingChildren="breadcrumbCount"
>
<LanguageToggle
v-if="interfaceLanguage && (swiftPath || objcPath)"
Expand All @@ -80,7 +52,7 @@
/>
<slot name="menu-items" />
</NavMenuItems>
<slot name="tray-after" v-bind="{ breadcrumbCount }" />
<slot name="tray-after" />
</template>
<template #after-content>
<slot name="after-content" />
Expand All @@ -95,7 +67,6 @@ import { BreakpointName } from 'docc-render/utils/breakpoints';
import SidenavIcon from 'theme/components/Icons/SidenavIcon.vue';
import { SIDEBAR_HIDE_BUTTON_ID } from 'docc-render/constants/sidebar';
import { baseNavOpenSidenavButtonId } from 'docc-render/constants/nav';
import Hierarchy from './DocumentationNav/Hierarchy.vue';
import LanguageToggle from './DocumentationNav/LanguageToggle.vue';

export default {
Expand All @@ -104,26 +75,9 @@ export default {
SidenavIcon,
NavBase,
NavMenuItems,
Hierarchy,
LanguageToggle,
},
props: {
title: {
type: String,
required: false,
},
parentTopicIdentifiers: {
type: Array,
required: false,
},
isSymbolBeta: {
type: Boolean,
required: false,
},
isSymbolDeprecated: {
type: Boolean,
required: false,
},
isDark: {
type: Boolean,
default: false,
Expand All @@ -132,14 +86,6 @@ export default {
type: Boolean,
default: false,
},
currentTopicTags: {
type: Array,
required: true,
},
references: {
type: Object,
default: () => ({}),
},
interfaceLanguage: {
type: String,
required: false,
Expand All @@ -152,10 +98,6 @@ export default {
type: String,
required: false,
},
sidenavHiddenOnLarge: {
type: Boolean,
default: false,
},
displaySidenav: {
type: Boolean,
default: false,
Expand All @@ -164,38 +106,6 @@ export default {
computed: {
baseNavOpenSidenavButtonId: () => baseNavOpenSidenavButtonId,
BreakpointName: () => BreakpointName,
breadcrumbCount: ({ hierarchyItems }) => hierarchyItems.length + 1,
/**
* Returns the first(root) hierarchy item reference
* @return {Object}
*/
rootHierarchyReference: ({ parentTopicIdentifiers, references }) => (
references[parentTopicIdentifiers[0]] || {}
),
/**
* Returns whether the root link is a technology page.
* @return {boolean}
*/
isRootTechnologyLink: ({ rootHierarchyReference: { kind } }) => kind === 'technologies',
/**
* Returns the root url reference object, if is a `technologies` link.
* Otherwise returns a manual route query object.
* @return {Object}
*/
rootLink: ({
isRootTechnologyLink, rootHierarchyReference, $route,
}) => (isRootTechnologyLink
? {
path: rootHierarchyReference.url,
query: $route.query,
} : null),
/**
* Strips out the first link, if is the root Technologies link.
* @return {string[]}
*/
hierarchyItems: ({ parentTopicIdentifiers, isRootTechnologyLink }) => (
isRootTechnologyLink ? parentTopicIdentifiers.slice(1) : parentTopicIdentifiers
),
},
methods: {
async handleSidenavToggle(closeNav, currentBreakpoint) {
Expand Down Expand Up @@ -233,24 +143,17 @@ $sidenav-icon-padding-size: 5px;
margin-left: $nav-space-between-elements;
}

@include nav-in-breakpoint {
// do not apply border if no item are above setting links
&:not([data-previous-menu-children-count="0"]) {
.nav-menu-setting:first-child {
border-top: 1px solid dark-color(figure-gray-tertiary);
display: flex;
align-items: center;
}
}
}

.nav-menu-setting {
display: flex;
align-items: center;
color: var(--color-nav-current-link);
margin-left: 0;
min-width: 0;

.nav-menu-link, .current-language, span {
font-weight: $font-weight-semibold;
}

&:first-child:not(:only-child) {
margin-right: $nav-space-between-elements;

Expand All @@ -274,17 +177,8 @@ $sidenav-icon-padding-size: 5px;

.documentation-nav {
:deep() {
// normalize the Title font with menu items
.nav-title {
@include font-styles(documentation-nav);

.nav-title-link.inactive {
height: auto;
color: var(--color-figure-gray-secondary-alt);
@include nav-dark($nested: true) {
color: dark-color(figure-gray-secondary-alt);
}
}
@include font-styles(nav-title-large);
}
}
}
Expand Down Expand Up @@ -317,6 +211,7 @@ $sidenav-icon-padding-size: 5px;
color: var(--color-nav-link-color);
position: relative;
margin: 0 (-$sidenav-icon-padding-size);
border-radius: $nano-border-radius;

@include nav-dark {
color: var(--color-nav-dark-link-color);
Expand All @@ -339,13 +234,6 @@ $sidenav-icon-padding-size: 5px;
}

@include nav-in-breakpoint() {
$space: 14px;
margin-left: -$space;
margin-right: -$space;
padding-left: $space;
padding-right: $space;
align-self: stretch;

&__separator {
display: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ $doc-hero-icon-dimension: 250px;

&__content:not(.minimized-hero) {
padding-top: rem(40px);
padding-bottom: 40px;
padding-bottom: rem(40px);
position: relative;
z-index: 1;
@include dynamic-content-container;
Expand Down Expand Up @@ -247,5 +247,4 @@ $doc-hero-icon-dimension: 250px;
// apply extra bottom padding when shouldShowLanguageSwitcher
padding-bottom: rem(65px);
}

</style>
Loading