Skip to content

Commit 67cc734

Browse files
columk1paulpopus
andauthored
chore(templates): replace arbitrary tailwind values with utilities in ecommerce template (#14654)
### Description This PR replaces unnecessary arbitrary values in class names for new utility classes that are available in V4. It's cosmetic but it removes 19 warnings from Tailwind Intellisense. ### How? I ran the migration command `npx @tailwindcss/upgrade` --------- Co-authored-by: Colum Kelly <columk1@users.noreply.github.com> Co-authored-by: Paul Popus <paul@payloadcms.com>
1 parent 40081f4 commit 67cc734

19 files changed

Lines changed: 30 additions & 32 deletions

File tree

templates/ecommerce/src/app/(app)/(account)/layout.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ export default async function RootLayout({ children }: { children: ReactNode })
1818
</div>
1919

2020
<div className="container mt-16 pb-8 flex gap-8">
21-
{user && (
22-
<AccountNav className="max-w-[15.5rem] grow flex-col items-start gap-4 hidden md:flex" />
23-
)}
21+
{user && <AccountNav className="max-w-62 grow flex-col items-start gap-4 hidden md:flex" />}
2422

2523
<div className="flex flex-col gap-12 grow">{children}</div>
2624
</div>

templates/ecommerce/src/blocks/ArchiveBlock/Component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const ArchiveBlock: React.FC<
5757
<div className="my-16" id={`block-${id}`}>
5858
{introContent && (
5959
<div className="container mb-16">
60-
<RichText className="ml-0 max-w-[48rem]" data={introContent} enableGutter={false} />
60+
<RichText className="ml-0 max-w-3xl" data={introContent} enableGutter={false} />
6161
</div>
6262
)}
6363
<CollectionArchive posts={posts} />

templates/ecommerce/src/blocks/CallToAction/Component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const CallToActionBlock: React.FC<
1313
return (
1414
<div className="container">
1515
<div className="bg-card rounded border-border border p-4 flex flex-col gap-8 md:flex-row md:justify-between md:items-center">
16-
<div className="max-w-[48rem] flex items-center">
16+
<div className="max-w-3xl flex items-center">
1717
{richText && <RichText className="mb-0" data={richText} enableGutter={false} />}
1818
</div>
1919
<div className="flex flex-col gap-8">

templates/ecommerce/src/blocks/Form/Component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export const FormBlock: React.FC<
126126
)
127127

128128
return (
129-
<div className="container lg:max-w-[48rem]">
129+
<div className="container lg:max-w-3xl">
130130
{enableIntro && introContent && !hasSubmitted && (
131131
<RichText className="mb-8 lg:mb-12" data={introContent} enableGutter={false} />
132132
)}

templates/ecommerce/src/components/AccountNav/index.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export const AccountNav: React.FC<Props> = ({ className }) => {
1919
<Button asChild variant="link">
2020
<Link
2121
href="/account"
22-
className={clsx('text-primary/50 hover:text-primary/100 hover:no-underline', {
23-
'text-primary/100': pathname === '/account',
22+
className={clsx('text-primary/50 hover:text-primary hover:no-underline', {
23+
'text-primary': pathname === '/account',
2424
})}
2525
>
2626
Account settings
@@ -32,8 +32,8 @@ export const AccountNav: React.FC<Props> = ({ className }) => {
3232
<Button asChild variant="link">
3333
<Link
3434
href="/account/addresses"
35-
className={clsx('text-primary/50 hover:text-primary/100 hover:no-underline', {
36-
'text-primary/100': pathname === '/account/addresses',
35+
className={clsx('text-primary/50 hover:text-primary hover:no-underline', {
36+
'text-primary': pathname === '/account/addresses',
3737
})}
3838
>
3939
Addresses
@@ -45,8 +45,8 @@ export const AccountNav: React.FC<Props> = ({ className }) => {
4545
<Button
4646
asChild
4747
variant="link"
48-
className={clsx('text-primary/50 hover:text-primary/100 hover:no-underline', {
49-
'text-primary/100': pathname === '/orders' || pathname.includes('/orders'),
48+
className={clsx('text-primary/50 hover:text-primary hover:no-underline', {
49+
'text-primary': pathname === '/orders' || pathname.includes('/orders'),
5050
})}
5151
>
5252
<Link href="/orders">Orders</Link>
@@ -59,8 +59,8 @@ export const AccountNav: React.FC<Props> = ({ className }) => {
5959
<Button
6060
asChild
6161
variant="link"
62-
className={clsx('text-primary/50 hover:text-primary/100 hover:no-underline', {
63-
'text-primary/100': pathname === '/logout',
62+
className={clsx('text-primary/50 hover:text-primary hover:no-underline', {
63+
'text-primary': pathname === '/logout',
6464
})}
6565
>
6666
<Link href="/logout">Log out</Link>

templates/ecommerce/src/components/Cart/DeleteItemButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function DeleteItemButton({ item }: { item: CartItem }) {
2727
}}
2828
type="button"
2929
>
30-
<XIcon className="hover:text-accent-3 mx-[1px] h-4 w-4 text-white dark:text-black" />
30+
<XIcon className="hover:text-accent-3 mx-px h-4 w-4 text-white dark:text-black" />
3131
</button>
3232
</form>
3333
)

templates/ecommerce/src/components/CategoryTabs/Item.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ export function Item({ href, title }: Props) {
1919
<li className="mt-2 flex text-sm text-black dark:text-white">
2020
<DynamicTag
2121
className={clsx(
22-
'w-full font-mono uppercase text-primary/50 px-2 text-sm py-1 rounded-md hover:bg-white/5 hover:text-primary/100',
22+
'w-full font-mono uppercase text-primary/50 px-2 text-sm py-1 rounded-md hover:bg-white/5 hover:text-primary',
2323
{
24-
'bg-white/5 text-primary/100': active,
24+
'bg-white/5 text-primary': active,
2525
},
2626
)}
2727
href={href}

templates/ecommerce/src/components/Footer/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export async function Footer() {
5353
&copy; {copyrightDate} {copyrightName}
5454
{copyrightName.length && !copyrightName.endsWith('.') ? '.' : ''} All rights reserved.
5555
</p>
56-
<hr className="mx-4 hidden h-4 w-[1px] border-l border-neutral-400 md:inline-block" />
56+
<hr className="mx-4 hidden h-4 w-px border-l border-neutral-400 md:inline-block" />
5757
<p>Designed in Michigan</p>
5858
<p className="md:ml-auto">
5959
<a className="text-black dark:text-white" href="https://payloadcms.com">

templates/ecommerce/src/components/Logo/Logo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const Logo = () => {
55
/* eslint-disable @next/next/no-img-element */
66
<img
77
alt="Payload Logo"
8-
className="max-w-[9.375rem] invert dark:invert-0"
8+
className="max-w-37.5 invert dark:invert-0"
99
src="https://raw.githubusercontent.com/payloadcms/payload/main/packages/payload/src/admin/assets/images/payload-logo-light.svg"
1010
/>
1111
)

templates/ecommerce/src/components/OrderItem/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const OrderItem: React.FC<Props> = ({ order }) => {
1515
return (
1616
<div className="bg-card border rounded-lg px-4 py-2 md:px-6 md:py-4 flex flex-col sm:flex-row gap-12 sm:items-center sm:justify-between">
1717
<div className="flex flex-col gap-4">
18-
<h3 className="text-sm uppercase font-mono tracking-[0.1em] text-primary/50 truncate max-w-[8rem] sm:max-w-none">{`#${order.id}`}</h3>
18+
<h3 className="text-sm uppercase font-mono tracking-widest text-primary/50 truncate max-w-32 sm:max-w-none">{`#${order.id}`}</h3>
1919

2020
<div className="flex flex-col-reverse sm:flex-row sm:items-center gap-6">
2121
<p className="text-xl">

0 commit comments

Comments
 (0)