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

Navigation Header component #706

Merged
merged 47 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
a676646
feat: add Logo component
timoheddes Aug 1, 2023
9ef5805
feat: export logo variants
timoheddes Aug 1, 2023
055b3a1
feat: navHeader
timoheddes Aug 1, 2023
cc32657
feat: add nav item selector styles
timoheddes Aug 1, 2023
884b534
fix: remove unnecessary ts-ignore
timoheddes Aug 1, 2023
b793fe5
feat: add basic test
timoheddes Aug 1, 2023
6528c12
refactor: keep things simple...
timoheddes Aug 1, 2023
504eaaf
refactor: single source for Logo variants
timoheddes Aug 1, 2023
a0117ad
refactor: tidy up
timoheddes Aug 1, 2023
63c9164
chore: Logo readme update
timoheddes Aug 1, 2023
88c1980
style: tweak size and margins
timoheddes Aug 1, 2023
9b0f243
chore: formatting (prettier)
timoheddes Aug 1, 2023
29223ff
feat: add optional children sample
timoheddes Aug 1, 2023
389cc85
feat: add glow effect
timoheddes Aug 2, 2023
0760a8b
chore: remove console.log
timoheddes Aug 2, 2023
eda2054
chore: optimisations (review feedback)
timoheddes Aug 2, 2023
011d78e
refactor: glow positioning and link style
timoheddes Aug 2, 2023
7b0cdb5
refactor: remove unused code
timoheddes Aug 2, 2023
262de16
refactor: semantics
timoheddes Aug 2, 2023
288425b
fix: jsx svg tag naming
timoheddes Aug 2, 2023
6aa054e
chore: add note to test file
timoheddes Aug 2, 2023
490530b
refactor: semantics
timoheddes Aug 2, 2023
b740de3
refactor: remove non-null assertions
timoheddes Aug 2, 2023
f8e6133
refactor: glow effect
timoheddes Aug 2, 2023
0f8a59c
refactor: glow effect animation timing
timoheddes Aug 2, 2023
5df8f95
refactor: logo name change
timoheddes Aug 2, 2023
5843c56
refactor: separate glow effect into custom hook
timoheddes Aug 3, 2023
0df2bce
fix: useGlow refactor mistake
timoheddes Aug 3, 2023
f4fbd24
refactor: semantics
timoheddes Aug 3, 2023
8c5c33c
refactor: restructure to support nextjs Link
timoheddes Aug 3, 2023
e8414e7
refactor: sprinkles
timoheddes Aug 3, 2023
45487ae
chore: clean up
timoheddes Aug 3, 2023
da0d83a
chore: remove console log
timoheddes Aug 3, 2023
b71a430
chore: rename Logo component
timoheddes Aug 3, 2023
04d0edf
chore: linting
timoheddes Aug 3, 2023
a23371e
feat: story controls
timoheddes Aug 3, 2023
1ce63cb
chore: remove console log
timoheddes Aug 3, 2023
3467e6c
chore: use ts extension for hook
timoheddes Aug 4, 2023
4c81aa6
refactor: use alignItems instead of alignSelf
timoheddes Aug 4, 2023
db6d9a4
refactor: structure
timoheddes Aug 7, 2023
3831e34
refactor: NavHeader.Link component
timoheddes Aug 7, 2023
48444ff
refactor: apply style to header Link component directly
timoheddes Aug 8, 2023
904f7be
refactor: cleanup
timoheddes Aug 8, 2023
d1c170c
feat: focused style of active nav item
timoheddes Aug 8, 2023
7de731e
refactor: BrandLogo component types
timoheddes Aug 8, 2023
8a8a5af
feat: strict children types
timoheddes Aug 8, 2023
e8dba45
chore: be more specific on children type of INavHeaderContainerProps
timoheddes Aug 9, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ const meta: Meta<StoryProps> = {
},
};

type Story = StoryObj<StoryProps>;
type IStory = StoryObj<StoryProps>;

export const Dynamic: Story = {
export const Dynamic: IStory = {
name: 'NavHeader',
args: {
brand: logoVariants[0],
Expand All @@ -107,8 +107,8 @@ export const Dynamic: Story = {
</NavHeader.Link>
))}
</NavHeader.Navigation>
{renderSampleContent && (
<NavHeader.Content>
<NavHeader.Content>
{renderSampleContent && (
<Button
as="button"
icon="Link"
Expand All @@ -119,8 +119,8 @@ export const Dynamic: Story = {
>
Connect your wallet
</Button>
</NavHeader.Content>
)}
)}
</NavHeader.Content>
</NavHeader.Root>
);
},
Expand Down
5 changes: 3 additions & 2 deletions packages/libs/react-ui/src/components/NavHeader/NavHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { containerClass, logoClass } from './NavHeader.css';
import { INavHeaderProps } from '.';

import type { LogoVariant } from '@components/BrandLogo';
import Logo, { logoVariants } from '@components/BrandLogo';
import { Link } from '@components/Link';
import React, { FC } from 'react';
import React, { FC, FunctionComponentElement } from 'react';

export type INavItemTarget = '_self' | '_blank';
export interface INavItem {
Expand All @@ -15,7 +16,7 @@ export type INavItems = INavItem[];

export interface INavHeaderContainerProps {
brand?: LogoVariant;
children?: React.ReactNode;
children?: FunctionComponentElement<INavHeaderProps>[];
timoheddes marked this conversation as resolved.
Show resolved Hide resolved
items?: INavItems;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import classNames from 'classnames';
import React, { FC } from 'react';

export interface INavHeaderLinkProps {
children: React.ReactNode;
children: string;
href: string;
active?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { glowClass, navListClass, navWrapperClass } from './NavHeader.css';
import { INavHeaderLinkProps } from './NavHeaderLink';
import useGlow from './useGlow';

import React, { FC } from 'react';
import React, { FC, FunctionComponentElement } from 'react';

export type INavItemTarget = '_self' | '_blank';
export interface INavItem {
Expand All @@ -14,7 +14,7 @@ export interface INavItem {
export type INavItems = INavItem[];

export interface INavHeaderNavigationProps {
children: React.ReactNode;
children: FunctionComponentElement<INavHeaderLinkProps>[];
}

export const NavHeaderNavigation: FC<INavHeaderNavigationProps> = ({
Expand All @@ -40,7 +40,7 @@ export const NavHeaderNavigation: FC<INavHeaderNavigationProps> = ({
<li key={`navItem-${index}`} onClick={() => setActiveNav(index + 1)}>
{React.cloneElement(
child as React.ReactElement<
HTMLElement & INavHeaderLinkProps,
HTMLElement | INavHeaderLinkProps,
| string
| React.JSXElementConstructor<JSX.Element & INavHeaderLinkProps>
>,
Expand Down