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

Develop #931

Merged
merged 26 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b6e72a3
fix: testing deep-linking feature
HZ991 Sep 26, 2024
3df7813
fix: format
HZ991 Sep 30, 2024
bc34de9
fix: added variable for DELAY_TIME_TO_SCROLL - removes magic number
HZ991 Oct 2, 2024
6e866f1
navigation using scrollTo and NextJS Link
HZ991 Oct 17, 2024
9a1acef
fix for the following: site sidebar, site header, ui badge, ui storyb…
HZ991 Oct 25, 2024
34fcc85
add: update to progress indicator component
HZ991 Oct 28, 2024
3e63189
fix: header className mismatch bug for site
HZ991 Oct 31, 2024
1542aad
Merge branch 'develop' into feature/deep-linking-built-in
HZ991 Oct 31, 2024
024462b
fix: add unique id to progress indicator paths
Oct 31, 2024
23dad1b
fix: add unique id to progress indicator paths
Oct 31, 2024
b67f066
Merge branch 'fix/style-fixes' of https://github.com/WestpacGEL/GEL-n…
HZ991 Nov 1, 2024
7bc4dfe
Merge branch 'fix/style-fixes' of https://github.com/WestpacGEL/GEL-n…
HZ991 Nov 1, 2024
64d4ff8
Merge branch 'fix/style-fixes' of https://github.com/WestpacGEL/GEL-n…
HZ991 Nov 1, 2024
252b1d2
Merge branch 'fix/style-fixes' of https://github.com/WestpacGEL/GEL-n…
HZ991 Nov 1, 2024
df9a783
feat: update anchor linking scroll to use css
Nov 7, 2024
b50cf34
Merge pull request #910 from WestpacGEL/feature/deep-linking-built-in
jaortiz Nov 8, 2024
1c5b2df
Merge branch 'fix/style-fixes' of https://github.com/WestpacGEL/GEL-n…
HZ991 Nov 1, 2024
5ef2790
Merge branch 'fix/style-fixes' of https://github.com/WestpacGEL/GEL-n…
HZ991 Nov 14, 2024
6da8266
Merge branch 'develop' into fix/style-fixes
HZ991 Nov 15, 2024
94d6345
added: circle arrow icons
HZ991 Nov 18, 2024
0a9659a
Merge pull request #930 from WestpacGEL/feature/arrow-circle-icons
jaortiz Nov 18, 2024
4963f21
Fix: omitted types from progress-indictator
HZ991 Nov 18, 2024
d7be6c0
Merge pull request #916 from WestpacGEL/fix/style-fixes
jaortiz Nov 18, 2024
7d94904
Merge branch 'main' of github.com:WestpacGEL/GEL-next into develop
Nov 18, 2024
8ec4dbc
Version Packages
github-actions[bot] Nov 18, 2024
7fe6058
Merge pull request #905 from WestpacGEL/changeset-release/develop
jaortiz Nov 18, 2024
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
5 changes: 0 additions & 5 deletions .changeset/beige-peaches-explain.md

This file was deleted.

9 changes: 9 additions & 0 deletions apps/protoform/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# protoform

## 0.2.4

### Patch Changes

- Updated dependencies [6f96072]
- Updated dependencies [23dad1b]
- Updated dependencies [94d6345]
- @westpac/ui@0.28.0

## 0.2.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/protoform/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "protoform",
"version": "0.2.3",
"version": "0.2.4",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
2 changes: 1 addition & 1 deletion apps/protoform/src/components/cta/cta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function Cta({
tertiaryOnClick?: () => void;
}) {
return (
<div className="flex gap-2 py-5 max-md:flex-col">
<div className="flex gap-2 pt-5 pb-9 max-md:flex-col">
<Button size="large" look="primary" className="md:px-2.5" onClick={primaryOnClick} type={primaryType}>
{children}
</Button>
Expand Down
2 changes: 1 addition & 1 deletion apps/protoform/src/components/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function Sidebar({ children }: { children?: ReactNode }) {
<>
<div
className={clsx(
'sticky top-0 flex h-9 justify-between bg-white px-2 py-3 after:pointer-events-none after:absolute after:inset-x-0 after:top-full after:z-10 after:block after:h-1 after:bg-gradient-to-b after:from-black/[.2] after:from-0% after:opacity-0 after:transition-all after:duration-200 after:will-change-[opacity] xsl:px-4 sm:px-5 md:hidden',
'sticky items-center top-0 flex h-9 justify-between bg-white px-2 py-3 after:pointer-events-none after:absolute after:inset-x-0 after:top-full after:z-10 after:block after:h-1 after:bg-gradient-to-b after:from-black/[.2] after:from-0% after:opacity-0 after:transition-all after:duration-200 after:will-change-[opacity] xsl:px-4 sm:px-5 md:hidden',
{ 'after:opacity-100': scrolled },
)}
>
Expand Down
9 changes: 9 additions & 0 deletions apps/site/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# site

## 0.3.4

### Patch Changes

- Updated dependencies [6f96072]
- Updated dependencies [23dad1b]
- Updated dependencies [94d6345]
- @westpac/ui@0.28.0

## 0.3.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/site/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "site",
"version": "0.3.3",
"version": "0.3.4",
"private": true,
"scripts": {
"build": "next build",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { List, ListItem } from '@westpac/ui';
import { MouseEventHandler, useCallback } from 'react';
import Link from 'next/link';
import { usePathname } from 'next/navigation';

import { ArrowDownRightIcon } from '@/components/icons';

Expand All @@ -10,7 +10,7 @@ import { type TableOfContentsProps } from './table-of-contents.types';
export function TableOfContents({ contents = [] }: TableOfContentsProps) {
return (
<nav>
<h2 className="typography-body-9 border-b border-border pb-2 font-medium">Page content</h2>
<h2 className="typography-body-9 border-border border-b pb-2 font-medium">Page content</h2>
<List icon={ArrowDownRightIcon} type="icon" look="primary" className="mt-3 [&_li]:my-1.5">
{contents.map(({ title }) => {
const id = title
Expand All @@ -20,7 +20,7 @@ export function TableOfContents({ contents = [] }: TableOfContentsProps) {
.join('-');
return (
<ListItem key={id} className="pl-[1.075rem]">
<Link href={`#${id}`}>{title}</Link>
<NavLink href={`#${id}`}>{title}</NavLink>
</ListItem>
);
})}
Expand All @@ -29,30 +29,12 @@ export function TableOfContents({ contents = [] }: TableOfContentsProps) {
);
}

const HEADER_HEIGHT = {
sm: 150,
lg: 200,
};

const BREAKPOINT_MD = 768;

function Link({ href, children }: { children?: React.ReactNode; href?: string }) {
const handleClick: MouseEventHandler<HTMLAnchorElement> = useCallback(
ev => {
ev.preventDefault();
const viewport = window.innerWidth < BREAKPOINT_MD ? 'sm' : 'lg';
const bodyRect = document.body.getBoundingClientRect(),
elemRect = document?.querySelector(href || '')?.getBoundingClientRect(),
offset = (elemRect?.top || 0) - bodyRect.top - HEADER_HEIGHT[viewport];

window?.scrollTo({ top: offset, behavior: 'smooth' });
},
[href],
);
function NavLink({ href, children }: { children?: React.ReactNode; href: string }) {
const pathname = usePathname();

return (
<a href={href} className="ml-1 block hover:underline focus-visible:focus-outline" onClick={handleClick}>
<Link className="focus-visible:focus-outline ml-1 block hover:underline" href={`${pathname}${href}`} replace scroll>
{children}
</a>
</Link>
);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { HamburgerMenuIcon } from '@westpac/ui/icon';
import React, { useEffect, useRef, useState } from 'react';
import React, { useLayoutEffect, useRef, useState } from 'react';

import { useSidebar } from '@/app/design-system/components/sidebar/sidebar.context';
import { BrandKey } from '@/app/types/brand.types';
Expand All @@ -11,41 +11,26 @@ import { styles as headerStyles } from './header.styles';
const FIXED_HEADER = 162; // 228 - 66 = height to stick

export function Header({ className, title, brand }: { brand: string; className?: string; title?: string }) {
const [fixed, setFixed] = useState(typeof window !== 'undefined' ? window.scrollY >= FIXED_HEADER : false);
const [fixed, setFixed] = useState(false);
const styles = headerStyles({ brand: brand.toLowerCase() as BrandKey, fixed, className });
const headerRef = useRef<HTMLHeadingElement>(null);
const { setOpen } = useSidebar();

useEffect(() => {
if (typeof window !== 'undefined') {
const handleScroll = () => {
const isFixed = window.scrollY >= FIXED_HEADER;
setFixed(isFixed);
};
window.addEventListener('scroll', handleScroll);
return () => window.removeEventListener('scroll', handleScroll);
}
useLayoutEffect(() => {
const handleScroll = () => {
const isFixed = window.scrollY >= FIXED_HEADER;
setFixed(isFixed);
};

handleScroll();

window.addEventListener('scroll', handleScroll);

return () => window.addEventListener('scroll', handleScroll);
}, []);

return (
<header className={styles.base()}>
<div className={styles.gridButtonWrapper()}>
<span className="sr-only">Active breakpoint:</span>
<span className="hidden font-bold sm:block md:hidden">SM</span>
<span className="hidden font-bold md:block lg:hidden">MD</span>
<span className="hidden font-bold lg:block">LG</span>
<button
aria-hidden="true"
className={styles.gridButton()}
onClick={() => {
return;
}}
>
{new Array(4).fill(null).map((_, index) => {
return <span className="w-[0.25rem] items-stretch bg-white/30" key={index} />;
})}
</button>
</div>
{/* The tab order on the original site was the grid button before wrapper when coming from the browser bar */}
<button className={styles.hamburgerButton()} onClick={() => setOpen(open => !open)}>
<HamburgerMenuIcon color="white" className="mx-auto" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ export function Sidebar({ items, brand }: SidebarProps) {
});

useEffect(() => {
if (!listRef.current) {
if (!outsideRef.current) {
return;
}
const listener = () => {
const y = listRef.current?.scrollTop || 0;
const y = outsideRef.current?.scrollTop || 0;
setScrolled(y > 0);
};
listRef.current.addEventListener('scroll', listener);
outsideRef.current.addEventListener('scroll', listener);
return () => {
listRef.current?.removeEventListener('scroll', listener);
outsideRef.current?.removeEventListener('scroll', listener);
};
}, [listRef]);
}, []);

useEffect(() => {
if (open) {
Expand Down Expand Up @@ -81,8 +81,8 @@ export function Sidebar({ items, brand }: SidebarProps) {
})}
>
<div
className={clsx({
'shadow-[rgba(0,0,0,0.26)_0_2px_5px]': scrolled,
className={clsx('sticky top-0 bg-white transition-shadow delay-0 duration-200 ease-[ease]', {
'shadow-[0_2px_5px_rgba(0,0,0,0.3)]': scrolled,
})}
>
<button
Expand Down
4 changes: 2 additions & 2 deletions apps/site/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ export const metadata: Metadata = {
export default function RootLayout({ children }: { children: React.ReactNode }) {
const { isEnabled } = draftMode();
return (
<html lang="en">
<html lang="en" className="scroll-smooth">
<FontPreloader />
<meta name="google-site-verification" content="OqpMflvRwQAgK3Lbvov6fs-G37wjQy1hqAH7ECgCW7M" />
<body>
{children}
{isEnabled && (
<div className="absolute right-15 top-3 z-[999]">
<div className="right-15 absolute top-3 z-[999]">
<form method="post" action="/preview/end">
<button className="text-white">End preview</button>
</form>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { tv } from 'tailwind-variants';

// scroll margin top = header height + 24px
export const styles = tv({
base: 'mt-5 font-bold first:mt-0',
base: 'mt-5 scroll-mt-[9.125rem] font-bold first:mt-0 md:scroll-mt-[11.25rem]',
variants: {
textAlign: {
left: 'text-left',
Expand All @@ -10,7 +11,7 @@ export const styles = tv({
},
level: {
1: 'typography-body-5 mb-3',
2: 'typography-body-7 mb-4 sm:typography-body-6 sm:mb-7',
2: 'typography-body-7 sm:typography-body-6 mb-4 sm:mb-7',
3: 'typography-body-8 mb-2',
4: 'typography-body-10 mb-2 uppercase',
5: 'typography-body-9 mb-2',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@
<span>Label</span>
</div>
</Button>
<a className="text-link underline" href="#">
Messages
<Badge color="muted" type="pill" className="ml-1">
<a className="text-link flex items-center" href="#">
<div className="underline">
Product feature
</div>
<Badge color="muted" type="pill" className="ml-1 no-underline">
12
</Badge>
</a>
Expand Down Expand Up @@ -65,12 +67,11 @@

<a className="text-link underline" href="#">
Product feature
<Badge color="muted" className="ml-1">
<Badge color="muted" className="ml-1">
NEW
</Badge>
</a>


</div>
</div>
</div>
Expand Down
Loading
Loading