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: update navbar #304

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 0 additions & 2 deletions src/components/shared/burger/burger.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@ const Burger = ({ className: additionalClassName, isToggled, onClick }) => (
variants={{
initial: {
display: 'block',
transition: { delay: ANIMATION_DURATION },
},
toggled: {
display: 'none',
transition: { delay: ANIMATION_DURATION },
},
}}
/>
Expand Down
15 changes: 11 additions & 4 deletions src/components/shared/button-github-stars/button-github-stars.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import React from 'react';

import Button from 'components/shared/button';
import GitHubIcon from 'icons/github.inline.svg';
// eslint-disable-next-line import/no-named-as-default
import buttonClick from 'utils/use-landing-simple-tracking';

const ButtonGithubStars = ({ className }) => {
const ButtonGithubStars = ({ className, size }) => {
const {
github: { url, count },
} = useStaticQuery(graphql`
Expand All @@ -21,7 +22,7 @@ const ButtonGithubStars = ({ className }) => {

return (
<Button
className={clsx('group', className)}
className={clsx('group', size === 'small' && 'border-0 !px-0', className)}
size="xs"
theme="gray-outline"
to={url}
Expand All @@ -30,9 +31,13 @@ const ButtonGithubStars = ({ className }) => {
onClick={buttonClick('github_star', { type: 'menu' })}
>
<GitHubIcon className="mr-2 h-[26px] w-[26px]" />
<span className="lg:hidden">Star us</span>
{size === 'large' && <span className="lg:hidden">Star us</span>}
<span
className="flex items-center before:mx-2.5 before:h-[18px] before:w-px before:bg-gray-4 before:transition-colors before:duration-200 group-hover:before:bg-gray-5"
className={clsx(
'flex items-center',
size === 'large' &&
'before:mx-2.5 before:h-[18px] before:w-px before:bg-gray-4 before:transition-colors before:duration-200 group-hover:before:bg-gray-5'
)}
aria-label={`${count} stars on Github`}
>
{`${(count / 1000).toFixed(1)}k`}
Expand All @@ -43,10 +48,12 @@ const ButtonGithubStars = ({ className }) => {

ButtonGithubStars.propTypes = {
className: PropTypes.string,
size: PropTypes.oneOf(['large', 'small']),
};

ButtonGithubStars.defaultProps = {
className: null,
size: 'large',
};

export default ButtonGithubStars;
66 changes: 0 additions & 66 deletions src/components/shared/header/dropdown/developers/developers.jsx

This file was deleted.

Binary file not shown.
3 changes: 0 additions & 3 deletions src/components/shared/header/dropdown/developers/index.js

This file was deleted.

175 changes: 121 additions & 54 deletions src/components/shared/header/dropdown/dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@ import clsx from 'clsx';
import { AnimatePresence, domAnimation, LazyMotion, m } from 'framer-motion';
import React from 'react';

import Developers from './developers';
import Product from './product';
import Link from 'components/shared/link';
import LINKS from 'constants/links';

const Dropdown = ({ isDropdownOpen, dropdownMenuContent, setDropdownOpen }) => (
<LazyMotion features={domAnimation}>
<AnimatePresence>
{isDropdownOpen && (
<m.div
className={clsx(
'absolute bottom-1.5 translate-y-full p-3.5 bg-[#0F0F0F] outline outline-gray-2 rounded-[20px] shadow-[0px_20px_50px_0px_rgba(0,0,0,0.8),0px_4px_12px_0px_rgba(0,0,0,0.3)] transition-[left,min-width] duration-[0.4s] ease-in-out overflow-hidden will-change-transform',
'absolute -bottom-2 w-[680px] translate-y-full rounded-2xl border border-gray-2 bg-[#0F0F0F] p-2 shadow-[0px_20px_50px_0px_rgba(0,0,0,0.8),0px_4px_12px_0px_rgba(0,0,0,0.3)] transition-[left,min-width] duration-[0.4s] ease-in-out will-change-transform lg:-left-3.5',
'before:absolute before:-top-1.5 before:left-1/2 before:z-10 before:h-3.5 before:w-3.5 before:rotate-45 before:rounded-[1px] before:border before:border-gray-2 before:bg-[#0F0F0F]',
{
'-left-1 min-w-[262px]': dropdownMenuContent?.label === 'product',
'left-[100px] min-w-[394px]': dropdownMenuContent?.label === 'developers',
'-left-[272px] before:-translate-x-6 lg:before:-translate-x-72':
dropdownMenuContent?.label === 'product',
'-left-40 before:-translate-x-[7px] lg:before:-translate-x-44':
dropdownMenuContent?.label === 'developers',
'-left-8 before:-translate-x-[5px] lg:before:-translate-x-16':
dropdownMenuContent?.label === 'resources',
}
)}
initial={{
Expand All @@ -32,56 +37,118 @@ const Dropdown = ({ isDropdownOpen, dropdownMenuContent, setDropdownOpen }) => (
onMouseEnter={() => setDropdownOpen(true)}
onMouseLeave={() => setDropdownOpen(false)}
>
{dropdownMenuContent?.label === 'product' && (
<m.div
initial={{
opacity: 0,
minWidth: 0,
}}
animate={{
opacity: 1,
minWidth: '234px',
}}
exit={{
opacity: 0,
width: 0,
}}
transition={{
minWidth: { duration: 0.2 },
opacity: { duration: 0.2, delay: 0.2 },
}}
key="product"
>
<Product items={dropdownMenuContent?.items} />
</m.div>
)}
{dropdownMenuContent?.label === 'developers' && (
<m.div
initial={{
opacity: 0,
width: 0,
}}
animate={{
opacity: 1,
width: 'auto',
}}
exit={{
opacity: 0,
width: 0,
transition: {
width: { duration: 0.2, delay: 0.2 },
opacity: { duration: 0.2 },
},
}}
transition={{
width: { duration: 0.2 },
opacity: { duration: 0.2, delay: 0.2 },
}}
key="developers"
>
<Developers items={dropdownMenuContent?.items} />
</m.div>
<ul
className={clsx('relative z-20 gap-2', {
'grid grid-cols-2 grid-rows-[261px_186px_106px]':
dropdownMenuContent?.label === 'product',
'flex flex-col':
dropdownMenuContent?.label === 'developers' ||
dropdownMenuContent?.label === 'resources',
})}
>
{dropdownMenuContent?.items.map(
({ title, description, icon, image, to, items }, index) => {
const itemTitle = (
<>
{image ? (
<img
className="rounded-md border border-[#333347]/20"
src={image}
alt=""
width={294}
height={164}
/>
) : (
<img src={icon} alt="" width={44} height={44} />
)}
<span className={clsx('flex flex-col items-start gap-y-2', image && 'pr-9')}>
<span
className={clsx(
'text-lg text-current',
image ? 'leading-snug' : 'whitespace-nowrap leading-none'
)}
>
{title}
</span>
<span
className={clsx(
'text-gray-8',
image
? 'line-clamp-3 text-sm leading-normal'
: 'whitespace-nowrap text-base leading-none'
)}
>
{description}
</span>
</span>
</>
);

return (
<li
className={clsx(
'rounded-lg border border-[#333347]/30 bg-[#12121C]/50 p-6 pt-[22px]',
{
'col-span-full': index === 0,
'row-span-2 row-start-2': index === 1,
'!py-[30px]': index === 3,
}
)}
key={index}
>
{to ? (
<Link
className={clsx('flex items-center', image ? 'gap-x-[19px]' : 'gap-x-3')}
theme="white"
to={to}
>
{itemTitle}
</Link>
) : (
<>
<p className="flex items-center gap-x-3 text-white">{itemTitle}</p>
<ul
className={clsx('mt-8 grid gap-y-[18px]', {
'grid-cols-2 gap-x-[50px]': index === 0,
})}
>
{items.map(({ title, icon, ...linkProps }, index) => (
<li key={index}>
<Link
className="flex items-center gap-x-3 whitespace-nowrap font-light leading-none outline-none"
size="base"
theme="gray-9"
{...linkProps}
>
<img
className="shrink-0"
src={icon}
alt=""
width={20}
height={20}
/>
{title}
</Link>
</li>
))}
</ul>
</>
)}
</li>
);
}
)}
</ul>
{(dropdownMenuContent?.label === 'developers' ||
dropdownMenuContent?.label === 'resources') && (
<p className="flex items-center justify-between p-6 pb-3.5 pt-[22px] text-base font-light leading-none text-gray-9">
<span>Any questions? We&apos;re here to help</span>
<Link className="text-[15px]" theme="primary" withArrow {...LINKS.contactUsCTA}>
Contact us
</Link>
</p>
)}
<div className="absolute left-1/2 top-0 z-10 h-4 w-11/12 -translate-x-1/2 bg-[#0F0F0F]" />
</m.div>
)}
</AnimatePresence>
Expand Down
3 changes: 0 additions & 3 deletions src/components/shared/header/dropdown/product/index.js

This file was deleted.

Loading