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(Footer): add footer docs #278

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
22 changes: 22 additions & 0 deletions src/content/components/navigation/Footer/FooterComponent.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@use '../../../../variables';

$block: '.#{variables.$ns}navigation-footer';

#{$block} {
display: flex;
flex-direction: column;
position: relative;
box-sizing: border-box;
height: 100%;
width: 100%;

*,
*::before,
*::after {
box-sizing: border-box;
}

&__body {
flex: 1;
}
}
31 changes: 31 additions & 0 deletions src/content/components/navigation/Footer/FooterComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import {Footer, FooterProps, MobileFooter} from '@gravity-ui/navigation';
import React from 'react';

import {block} from '../../../../utils';

import './FooterComponent.scss';
import {logo, menuItems} from './constants';

const b = block('navigation-footer');

type FooterComponentProps = Pick<FooterProps, 'withDivider' | 'view' | 'copyright'> & {
mobile?: boolean;
};

export function FooterComponent({withDivider, view, copyright, mobile}: FooterComponentProps) {
const Component = mobile ? MobileFooter : Footer;

return (
<div className={b()}>
<div className={b('body')} />
<Component
className={b('footer')}
menuItems={menuItems}
copyright={copyright}
logo={logo}
withDivider={withDivider}
view={view}
/>
</div>
);
}
28 changes: 28 additions & 0 deletions src/content/components/navigation/Footer/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Aperture from '@gravity-ui/icons/svgs/aperture.svg';
import {FooterMenuItem} from '@gravity-ui/navigation';

export const menuItems: FooterMenuItem[] = [
{
text: 'About Service',
href: 'https://gravity-ui.com/',
target: 'blank',
},
{
text: 'Documentation',
href: 'https://gravity-ui.com/',
target: 'blank',
},
{
text: 'Confidential',
href: 'https://gravity-ui.com/',
target: 'blank',
},
];

export const logo = {
icon: Aperture,
iconSize: 24,
text: 'Gravity UI',
'aria-label': 'Gravity UI',
target: 'blank',
};
38 changes: 38 additions & 0 deletions src/content/components/navigation/Footer/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import dynamic from 'next/dynamic';

import {Repos} from '../../../../types/common';
import {getGithubUrl, getReadmeUrl, mappingOptions} from '../../utils';

const getterOptions = {repoName: Repos.Navigation, componentName: 'Footer'};

export const footerConfig = {
id: 'footer',
title: 'Footer',
githubUrl: getGithubUrl(getterOptions),
content: {
readmeUrl: getReadmeUrl(getterOptions),
},
sandbox: {
expandedContainer: true,
component: dynamic(() => import('./FooterComponent').then((mod) => mod.FooterComponent)),
props: {
mobile: {
type: 'switch',
defaultValue: false,
},
withDivider: {
type: 'switch',
defaultValue: true,
},
view: {
type: 'select',
defaultValue: 'normal',
values: mappingOptions(['normal', 'clear']),
},
copyright: {
type: 'text',
defaultValue: `@ ${new Date().getFullYear()} "Gravity UI"`,
},
},
},
};
2 changes: 2 additions & 0 deletions src/content/components/navigation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {actionBarConfig} from './ActionBar';
import {allPagesPanelConfig} from './AllPagesPanel';
import {asideHeaderConfig} from './AsideHeader';
import {drawerConfig} from './Drawer';
import {footerConfig} from './Footer';
import {hotkeysPanelConfig} from './HotkeysPanel';
import {mobileHeaderConfig} from './MobileHeader';
import {settingsConfig} from './Settings';
Expand All @@ -21,6 +22,7 @@ const components: Component[] = [
hotkeysPanelConfig,
mobileHeaderConfig,
settingsConfig,
footerConfig,
];

export const navigationComponents: Lib = {
Expand Down
Loading