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

feat: new mobile-ui and refactoring gravity-ui/page-constructor navigation #57

Merged
merged 70 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
458a3b2
fix: override style to new SubNavigation
Jul 16, 2024
5619691
Merge branch 'master' of github.com:diplodoc-platform/client
Jul 16, 2024
bbfedcf
fix
Jul 16, 2024
f9c23b1
fix: on page without MiniToc share-button and menu appear incorrectly
Jul 16, 2024
7e21791
fix: package.json
Jul 17, 2024
449f021
fix: update @diplodoc/components version
Jul 18, 2024
7a5dc40
Merge branch 'diplodoc-platform:master' into master
JeikZim Jul 18, 2024
d3fe327
Merge branch 'diplodoc-platform:master' into master
JeikZim Jul 18, 2024
7fe9fb2
fix: headerHeight and subNavigationHeight variables
Jul 19, 2024
a31d3b7
Merge branch 'master' of github.com:JeikZim/client
Jul 19, 2024
1a2d72a
fix: headerHeight variable
Jul 19, 2024
27ed39d
fix: variables headerHeight
Jul 21, 2024
2594043
fix: Layout_content margin
Jul 26, 2024
2160d64
Merge branch 'diplodoc-platform:master' into master
JeikZim Jul 29, 2024
19d6479
fix: wide-format
Aug 2, 2024
a4b28c3
fix: wide-format
Aug 2, 2024
62f579f
feat: add new mobile-ui
Aug 28, 2024
abaa871
fetch
Aug 28, 2024
4fe3c6b
fix: on page without MiniToc share-button and menu appear incorrectly
Jul 16, 2024
0a2be46
fix: update @diplodoc/components version
Jul 18, 2024
418bc0a
fix: headerHeight and subNavigationHeight variables
Jul 19, 2024
5114b69
Merge branch 'master' of github.com:JeikZim/client
Aug 28, 2024
d3daa65
update package-lock.json
Aug 29, 2024
81c1fb1
update package-lock.json
Aug 29, 2024
e0427bf
update package-lock.json --force
Aug 29, 2024
0fdca88
update package-lock.json
Aug 29, 2024
f6cf9d5
feat: update version of @gravity-ui/page-constructor
Aug 30, 2024
2a64e24
fix: intersection of styles
Sep 1, 2024
191981b
fix: accessability for dir='rtl'
Sep 1, 2024
904f111
refactor: declaration-no-important
Sep 1, 2024
73e6fee
fix: update package-lock.json
Sep 2, 2024
3569067
fix: update package-lock.json
Sep 2, 2024
bb34c19
fix: update package-lock.json
Sep 2, 2024
feb200b
fix: update package-lock.json
Sep 2, 2024
376ad81
fix: update package-lock.json
Sep 2, 2024
e034627
fix: update package-lock.json
Sep 2, 2024
b670020
fix: update package-lock.json
Sep 2, 2024
2e3e6b0
fix: update package-lock.json
Sep 2, 2024
d69d0e1
fix: update package-lock.json
Sep 2, 2024
9d19caa
Merge branch 'master' of github.com:JeikZim/client
Sep 2, 2024
c1cdd5f
fix: onChangeLang
Sep 2, 2024
a99862c
refactor: constorlSize in App.tsx
Sep 2, 2024
bebca5b
fix: subnavigation sidebar styles
Sep 5, 2024
2907a0c
feat: add mobileDropdown in page constructor custom navigation elements
Sep 6, 2024
a4f807e
fix: padding between search and burger
Sep 6, 2024
97aec17
fix: wide-formatt on viewer
Sep 6, 2024
0bdbdaf
chore: update @diplodoc/components version
Sep 17, 2024
85370f4
chore: update package-lock.json
Sep 17, 2024
8f09529
chore: update PC
Sep 17, 2024
8ca4d85
chore: change PC version to 5.22.0
Sep 17, 2024
1845f31
chore: change PC version to 5.24.0
Sep 17, 2024
c152dbe
revert: update @diplodoc/components versioin
Sep 17, 2024
0a712d0
Merge branch 'master' of github.com:JeikZim/client
Sep 17, 2024
3f5b756
chore: downgrade @diplodoc/components version
Sep 17, 2024
5b0ff99
chore: downgrade @gravity-ui/page-constructor version
Sep 17, 2024
a9b90ab
chore: downgrade @gravity-ui/page-constructor version
Sep 17, 2024
c207b0c
chore: downgrade package versions
Sep 17, 2024
429e052
chore: downgrade package versions
Sep 17, 2024
65a5567
chore: revert package-lock.json
Sep 17, 2024
28dc202
fix: npm ci error
Sep 17, 2024
0b3ce08
Revert "fix: npm ci error"
Sep 17, 2024
a9402d3
fix: npm ci error
Sep 17, 2024
cff251b
fix: npm ci error
Sep 17, 2024
d941c41
fix: npm ci error
Sep 17, 2024
c8aed7f
fix: npm ci error
Sep 17, 2024
45179d6
fix: npm ci error
Sep 17, 2024
6e0df61
fix: npm ci error
Sep 17, 2024
17411d7
chore: update @diplodoc/components
Sep 17, 2024
fb9dab9
chore: update @diplodoc/components
Sep 17, 2024
aff2656
chore: remove @diplodoc/eslint-config
Sep 17, 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
1,859 changes: 385 additions & 1,474 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@
},
"devDependencies": {
"@diplodoc/babel-preset": "^1.0.2",
"@diplodoc/components": "^4.10.0",
"@diplodoc/components": "^4.12.0",
"@diplodoc/lint": "^1.1.1",
"@diplodoc/openapi-extension": "^2.1.0",
"@diplodoc/tsconfig": "^1.0.2",
"@gravity-ui/page-constructor": "^5.0.1",
"@gravity-ui/page-constructor": "^5.22.0",
"@gravity-ui/uikit": "^6.1.1",
"@types/react": "^18.2.7",
"@types/react-dom": "^18.2.4",
Expand All @@ -60,7 +60,7 @@
"mini-css-extract-plugin": "^2.7.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-svg-loader": "^3.0.3",
"react-svg-loader": "^3.0.0",
"rtlcss": "^4.1.1",
"sass": "^1.69.5",
"sass-loader": "^13.3.2",
Expand Down
1 change: 1 addition & 0 deletions src/components/App/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

.dc-root_full-header & {
--dc-header-height: 64px;
--dc-subnavigation-height: 52px;
}
}

Expand Down
32 changes: 28 additions & 4 deletions src/components/App/App.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
import React, {ReactElement, useCallback, useEffect} from 'react';
import {
NavigationData,
NavigationDropdownItem,
PageConstructor,
PageConstructorProvider,
PageContent,
} from '@gravity-ui/page-constructor';
import {ThemeProvider} from '@gravity-ui/uikit';
import {
ConsentPopup,
ControlSizes,
CustomNavigation,
DocContentPageData,
DocLeadingPageData,
DocPageData,
DocumentType,
Lang,
MobileDropdown,
Router,
Theme,
configure,
getLangPath,
getPageByType,
getPageType,
} from '@diplodoc/components';
import '@diplodoc/transform/dist/js/yfm';
import {MermaidRuntime} from '@diplodoc/mermaid-extension/react';
import {LatexRuntime} from '@diplodoc/latex-extension/react';
import {Runtime as OpenapiSandbox} from '@diplodoc/openapi-extension/runtime';
import '@diplodoc/transform/dist/js/yfm';

import {HeaderControls} from '../HeaderControls';
import {getDirection, updateRootClassName} from '../../utils';
Expand All @@ -35,6 +39,8 @@ import '../../interceptors/leading-page-links';

import './App.scss';

const HEADER_HEIGHT = 64;

export type DocAnalytics = {
gtm?: {
id?: string;
Expand Down Expand Up @@ -211,6 +217,11 @@ export function App(props: DocInnerProps): ReactElement {
const {leftItems = [], rightItems = []} = header as NavigationData['header'];
const headerWithControls = rightItems.some((item: {type: string}) => item.type === 'controls');

const userSettings = {...settings, langs, onChangeLang};

const navigationTocData = {toc: data.toc, router, headerHeight: HEADER_HEIGHT};
const mobileControlsData = {controlSize: ControlSizes.L, lang, userSettings};

return (
<div className={appClassName}>
<ThemeProvider theme={theme} direction={direction}>
Expand All @@ -226,6 +237,9 @@ export function App(props: DocInnerProps): ReactElement {
mobileView={mobileView}
/>
),
MobileDropdown: (item: NavigationDropdownItem) => (
<MobileDropdown item={item} />
),
},
blocks: {
page: () => (
Expand Down Expand Up @@ -260,10 +274,20 @@ export function App(props: DocInnerProps): ReactElement {
fullHeader
? {
header: {
withBorder: true,
leftItems: leftItems,
rightItems: rightItems,
leftItems: [],
},
renderNavigation: () => (
<CustomNavigation
logo={logo}
data={{
withBorder: true,
leftItems: leftItems,
rightItems: rightItems,
}}
navigationTocData={navigationTocData}
mobileControlsData={mobileControlsData}
/>
),
logo,
}
: undefined
Expand Down
6 changes: 4 additions & 2 deletions src/components/Layout/Layout.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import "../../styles/variables";

.Layout {
&__header {
position: sticky;
Expand All @@ -8,13 +10,13 @@
&__body {
display: flex;
flex-flow: column;
min-height: calc(100vh - var(--dc-header-height));
min-height: calc(100vh - var(--dc-header-height, #{$headerHeight}));
}

.pc-page-constructor & {
&__content {
flex: 1 1 auto;
margin: 0 -10px;
margin: 0 -8px;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/styles/default.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ body {
.g-root {
--dc-header-height: 0;
--dc-subheader-height: 40px;
--dc-subnavigation-height: 52px;

--dc-error-image-403: url('data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=');
--dc-error-image-404: url('data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=');
Expand Down
71 changes: 47 additions & 24 deletions src/styles/overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
}
}


.App.document-mode {
.pc-Grid {
padding-right: 40px;
Expand All @@ -16,7 +15,7 @@
padding: 0;
}

@media (max-width: map-get($screenBreakpoints, 'md')) {
@media (max-width: map-get($screenBreakpoints, 'md') - 1) {
padding-right: 20px;
padding-left: 20px;

Expand Down Expand Up @@ -52,31 +51,43 @@
max-width: 1440px;
}

.dc-doc-page__main:has(.dc-doc-page__content > .pc-page-constructor),
.dc-doc-page__main:has(.dc-doc-page__content > .pc-page-constructor__docs) {
padding: 20px 0 24px;
}

.dc-doc-page__main:has(.dc-doc-page__content > .pc-page-constructor) {
padding: 20px 0 24px;
.dc-root_wide-format {
@media (max-width: map-get($screenBreakpoints, 'md') - 1) {
& .dc-subnavigation {
$wideFormatHorizontalPadding: 8px;

padding-inline: 0 $wideFormatHorizontalPadding;
width: calc(100% - $wideFormatHorizontalPadding);
}

& .dc-doc-page__main {
padding-inline: #{$wideFormatHorizontalPadding};
}
}
}

.pc-block-base {
padding: 0 !important;
padding: 0 !important; /* stylelint-disable-line declaration-no-important */
}

.pc-navigation {
z-index: 101;
z-index: 120;

.desktop .dc-root_wide-format & .container-fluid {
padding: 0;
padding: 30px;

& .col {
padding: 0;
}
}

.mobile .dc-root_wide-format & .container-fluid {
padding: 12px;
padding: 0 8px 0 12px;

& .col {
padding: 0;
Expand All @@ -102,30 +113,42 @@
width: 100%;
transition: width 0.3s;
}

&__mobile-navigation-container {
margin-right: 0;
}
}

.pc-navigation {
z-index: 101;
.pc-mobile-navigation {
z-index: 119;
}

.desktop.dc-root_wide-format & .container-fluid {
padding: 30px;
.gc-simple-consent.gc-analytics {
right: 0;
left: unset;
z-index: 101;
}

& .col {
padding: 0;
}
@media (max-width: map-get($screenBreakpoints, 'md') - 1) {
.dc-toc {
height: fit-content !important; /* stylelint-disable-line declaration-no-important */
JeikZim marked this conversation as resolved.
Show resolved Hide resolved
}

.mobile.dc-root_wide-format & .container-fluid {
padding: 12px;
body:not(:has(.pc-navigation)) .dc-sidebar {
top: var(--dc-subnavigation-height, 52px);
z-index: 117;
height: calc(100% - var(--dc-subnavigation-height, 52px));

& .col {
padding: 0;
&-navigation__button {
margin-right: 0;
}
}
}

.gc-simple-consent.gc-analytics {
right: 0;
left: unset;
z-index: 101;
body:has(.pc-navigation) .dc-sidebar {
--dc-header-height: var(--header-height, 64px);
}

.pc-navigation-item:has(.dc-controls) {
display: none;
}
}
2 changes: 2 additions & 0 deletions src/styles/variables.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Sizes
$headerHeight: 0px;
$subNavigationHeight: 52px;
$normalOffset: 20px;
$miniTocOffset: 56px;
$blockMarginBottomLarge: 20px;
Expand All @@ -8,6 +9,7 @@ $headerMarginTopLarge: 40px;
$headerMarginTopMedium: 32px;
$popupPadding: 16px;
$centerBlockMaxWidth: 736px;
$wideFormatHorizontalPadding: 8px;

$screenBreakpoints: (
'xs': 375px,
Expand Down
Loading