Skip to content

Commit

Permalink
feature(documentation-website): make social links into icons (#479)
Browse files Browse the repository at this point in the history
  • Loading branch information
Idrinth authored Mar 24, 2024
1 parent 72ca8d3 commit 7568091
Show file tree
Hide file tree
Showing 11 changed files with 204 additions and 123 deletions.
3 changes: 3 additions & 0 deletions documentation-website/public/assets/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions documentation-website/public/assets/linkedin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions documentation-website/public/assets/npm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions documentation-website/public/assets/slack.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
116 changes: 116 additions & 0 deletions documentation-website/src/components/header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import React from 'react';
import IAB from '../assets/iab.svg';
import {
NavLink,
} from 'react-router-dom';
import pkg from '../../package.json' with {
type: 'json'
};
import {
Lang,
} from './lang.tsx';
import DarkModeButton from './dark-mode-button.tsx';
import SocialLink from './social-link.tsx';

const Header = ({
window,
}: {window: Window},) => <header>
<div>
<img src={IAB} alt="@idrinth/api-bench" />
<strong>@idrinth/api-bench</strong>
<em>v{pkg.version}</em>
</div>
<nav>
<ul>
<SocialLink
to="https://www.npmjs.com/package/@idrinth/api-bench"
label={'npm'}
/>
<SocialLink
to="https://github.com/Idrinth/api-bench"
label={'github'}
/>
<SocialLink
to="https://www.linkedin.com/groups/9588634/"
label={'linkedin'}
/>
<SocialLink
to={
'https://idrinth-api-bench.slack.com/' +
'join/shared_invite/' +
'zt-2f4zmw2sz-c3etHzCFq3LtZpkR15xXMA' +
'#/shared-invite/email'
}
label={'slack'}
/>
</ul>
</nav>
<nav>
<ul>
<li>
<NavLink to="/"><Lang lnkey='home.nav' /></NavLink>
</li>
<li>
<NavLink to="/quick-start/">
<Lang lnkey='quick-start.nav' />
</NavLink>
</li>
<li>
<NavLink to="/contributing/">
<Lang lnkey='contributing.nav' />
</NavLink>
<ul>
<li>
<NavLink to="/contributing/contributors/">
<Lang lnkey='contributors.nav' />
</NavLink>
</li>
<li>
<NavLink to="/contributing/sponsors/">
<Lang lnkey='sponsors.nav' />
</NavLink>
</li>
</ul>
</li>
<li>
<NavLink to="/usage/">
<Lang lnkey='usage.nav' />
</NavLink>
<ul>
<li>
<NavLink to="/usage/autowiring/">
<Lang lnkey='autowiring.nav' />
</NavLink>
</li>
<li>
<NavLink to="/usage/results/">
<Lang lnkey='results.nav' />
</NavLink>
</li>
<li>
<NavLink to="/usage/logging/">
<Lang lnkey='logging.nav' />
</NavLink>
</li>
<li>
<NavLink to="/usage/middlewares/">
<Lang lnkey='middlewares.nav' />
</NavLink>
</li>
<li>
<NavLink to="/usage/storage/">
<Lang lnkey='storage.nav' />
</NavLink>
</li>
<li>
<NavLink to="/usage/routes/">
<Lang lnkey='routes.nav' />
</NavLink>
</li>
</ul>
</li>
</ul>
</nav>
<DarkModeButton window={window} />
</header>;
export default Header;
4 changes: 2 additions & 2 deletions documentation-website/src/components/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import DefaultMeta from './default-meta.tsx';
import Navbar from './navbar.tsx';
import Header from './header.tsx';
import Footer from './footer.tsx';
import React from 'react';
import Breadcrumbs from './breadcrumbs.tsx';
Expand All @@ -22,7 +22,7 @@ const Layout = ({
: '';
return <>
{meta}
<Navbar window={window || {}}/>
<Header window={window || {}}/>
<Breadcrumbs path={path}/>
<article>
{Outlet}
Expand Down
117 changes: 0 additions & 117 deletions documentation-website/src/components/navbar.tsx

This file was deleted.

20 changes: 20 additions & 0 deletions documentation-website/src/components/social-link.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';

interface SocialLinkType {
to: string;
label: string;
}
const SocialLink = ({
to,
label,
}: SocialLinkType,) => <li id={label}>
<a
href={to}
target='_blank'
rel='noreferrer'
title={label}
>
<img alt={label} src={'../../public/assets/' + label + '.svg'}/>
</a>
</li>;
export default SocialLink;
28 changes: 27 additions & 1 deletion documentation-website/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ nav a {
padding: 5px 10px;
}

header nav img {
max-height: 1em;
padding: 0;
}

header nav a.active {
background-color: var(--dark-green);
color: var(--white);
Expand Down Expand Up @@ -330,6 +335,13 @@ nav.breadcrumbs li:last-of-type::after {

header nav {
grid-column: 2;
grid-row: 1;
}

header #github img {
border: 1px solid #fff;
background: #fff;
border-radius: 50%;
}

header nav > ul {
Expand Down Expand Up @@ -377,7 +389,12 @@ nav.breadcrumbs li:last-of-type::after {

header button {
padding-right: 1em;
grid-column: 3;
grid-column: 4;
}

header nav:first-of-type {
grid-column: 2;
grid-row: 2;
}

.title-card {
Expand All @@ -399,6 +416,15 @@ nav.breadcrumbs li:last-of-type::after {
header div {
max-width: initial;
}

header nav:first-of-type {
grid-column: 3;
grid-row: 1;
}

header {
grid-template-columns: 30% auto auto 5%;
}
}

@media screen {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Navbar from '../../src/components/navbar.jsx';
import Header from '../../src/components/header.tsx';
import {
expect,
} from 'chai';
Expand All @@ -8,10 +8,10 @@ const window = new Window();

describe('components/navbar', () => {
it('should be a function', () => {
expect(Navbar,).to.be.a('function',);
expect(Header,).to.be.a('function',);
},);
it('() should be an object', () => {
const result = Navbar(window,);
const result = Header(window,);
expect(result,).to.be.an('object',);
},);
},);
17 changes: 17 additions & 0 deletions documentation-website/test/components/social-link.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import SL from '../../src/components/social-link.tsx';
import {
expect,
} from 'chai';

describe('components/breadcrumbs', () => {
it('should be a function', () => {
expect(SL,).to.be.a('function',);
},);
it('() should be an object', () => {
const result = SL({
to: '/',
label: '',
},);
expect(result,).to.be.a('object',);
},);
},);

0 comments on commit 7568091

Please sign in to comment.