Skip to content

Commit

Permalink
Merge pull request #3946 from quilljs/website-nav
Browse files Browse the repository at this point in the history
  • Loading branch information
luin authored Jan 9, 2024
2 parents 4074f5c + 2eaa476 commit f3ca6f7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 24 deletions.
4 changes: 2 additions & 2 deletions packages/website/root-wrapper.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MDXProvider } from '@mdx-js/react';
import { Highlight, themes, defaultProps } from 'prism-react-renderer';
import { Highlight, themes } from 'prism-react-renderer';
import CodePen from './src/components/CodePen';
import Editor from './src/components/Editor';
import {
Expand All @@ -26,8 +26,8 @@ const components = {
const matches = className.match(/language-(?<lang>.*)/);
return (
<Highlight
{...defaultProps}
code={children.props.children}
theme={themes.oneDark}
language={
matches && matches.groups && matches.groups.lang
? matches.groups.lang
Expand Down
40 changes: 21 additions & 19 deletions packages/website/src/components/Default.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import classNames from "classnames";
import { graphql, useStaticQuery } from "gatsby";
import { useState } from "react";
import Helmet from "react-helmet";
import LogoIcon from "../svg/logo.svg";
import GitHub from "./GitHub";
import classNames from 'classnames';
import { graphql, useStaticQuery } from 'gatsby';
import { useState } from 'react';
import Helmet from 'react-helmet';
import LogoIcon from '../svg/logo.svg';
import GitHub from './GitHub';
import * as styles from './Default.module.scss';

const Default = ({ children, pageType }) => {
const [isNavOpen, setIsNavOpen] = useState(false);
Expand All @@ -21,10 +22,10 @@ const Default = ({ children, pageType }) => {
return (
<>
<Helmet
bodyAttributes={{ class: classNames(pageType, "layout-default") }}
bodyAttributes={{ class: classNames(pageType, 'layout-default') }}
/>
<header className={pageType || undefined}>
<nav className={classNames("navbar-drop", { active: isNavOpen })}>
<nav className={classNames('navbar-drop', { active: isNavOpen })}>
<button
className="navbar-close"
onClick={() => setIsNavOpen(false)}
Expand All @@ -45,30 +46,30 @@ const Default = ({ children, pageType }) => {
Playground
</a>
</li>
<li className="navbar-item">
<li className="navbar-item" style={{ display: 'none' }}>
<a className="navbar-link" href="/blog/">
Blog
</a>
</li>
<li className="navbar-item">
<li className={classNames('navbar-item', styles.githubMenuItem)}>
<GitHub dark />
</li>
</ul>
</nav>
<nav className="container">
<ul className="navbar-list">
<li
className={classNames("navbar-item", {
active: pageType === "docs",
className={classNames('navbar-item', {
active: pageType === 'docs',
})}
>
<a className="navbar-link" href="/docs/quickstart/">
Documentation
</a>
</li>
<li
className={classNames("navbar-item", {
active: pageType === "guides",
className={classNames('navbar-item', {
active: pageType === 'guides',
})}
>
<a className="navbar-link" href="/guides/why-quill/">
Expand All @@ -81,18 +82,19 @@ const Default = ({ children, pageType }) => {
</a>
</li>
<li
className={classNames("navbar-item", {
active: pageType === "playground",
className={classNames('navbar-item', {
active: pageType === 'playground',
})}
>
<a className="navbar-link" href="/playground/">
Playground
</a>
</li>
<li
className={classNames("navbar-item", {
active: pageType === "blog",
className={classNames('navbar-item', {
active: pageType === 'blog',
})}
style={{ display: 'none' }}
>
<a className="navbar-link" href="/blog/">
Blog
Expand Down Expand Up @@ -124,7 +126,7 @@ const Default = ({ children, pageType }) => {
</a>
<a href="/docs/download/" className="action">
Download v
{data?.site.siteMetadata.version.split(".").slice(0, 2).join(".")}
{data?.site.siteMetadata.version.split('.').slice(0, 2).join('.')}
</a>
</div>
<div className="users row">
Expand Down
5 changes: 5 additions & 0 deletions packages/website/src/components/Default.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.githubMenuItem {
display: flex;
align-items: center;
justify-content: center;
}
6 changes: 3 additions & 3 deletions packages/website/static/assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ header:not(.home) .logo path {
list-style: none;
padding: 5em 0 1em;
position: absolute;
transition: margin-bottom 1s ease-out 0s;
transition: margin-bottom 0.4s ease-out 0s;
width: 100%;
z-index: 10;
}
Expand Down Expand Up @@ -1270,8 +1270,8 @@ body:not(.home) .navbar-link:before {
display: inline-block;
}
.navbar-drop.active {
margin-bottom: -25em;
transition: margin-bottom 1s ease-out 0s;
margin-bottom: -22em;
transition: margin-bottom 0.4s ease-out 0s;
}
.navbar-list .navbar-item,
.navbar-list .download-item {
Expand Down

0 comments on commit f3ca6f7

Please sign in to comment.