Skip to content

Commit

Permalink
Update create-next-app template CSS (#66043)
Browse files Browse the repository at this point in the history
Updates the `create-next-app` template CSS to:
- Prevent browsers (e.g. Safari) from using synthetic bold font weights
- Move CSS variables out of global CSS / Tailwind config, to simplify
the process of wiping the default template.

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->

Co-authored-by: JJ Kasper <[email protected]>
  • Loading branch information
ypessoa and ijjk authored May 21, 2024
1 parent 1ad97e4 commit a38caf4
Show file tree
Hide file tree
Showing 20 changed files with 92 additions and 144 deletions.
15 changes: 1 addition & 14 deletions packages/create-next-app/templates/app-tw/js/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,17 @@
:root {
--background: #ffffff;
--foreground: #171717;

--gray-rgb: 0, 0, 0;
--gray-alpha-200: rgba(var(--gray-rgb), 0.08);
--gray-alpha-100: rgba(var(--gray-rgb), 0.05);

--button-primary-hover: #383838;
--button-secondary-hover: #f2f2f2;
}

@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;

--gray-rgb: 255, 255, 255;
--gray-alpha-200: rgba(var(--gray-rgb), 0.145);
--gray-alpha-100: rgba(var(--gray-rgb), 0.06);

--button-primary-hover: #ccc;
--button-secondary-hover: #1a1a1a;
}
}

body {
color: var(--foreground);
background: var(--background);
font-synthesis: none;
}
6 changes: 3 additions & 3 deletions packages/create-next-app/templates/app-tw/js/app/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function Home() {
<ol className="font-mono list-inside list-decimal text-sm text-center sm:text-left">
<li className="mb-2">
Get started by editing{" "}
<code className="bg-gray-alpha-100 px-1 py-0.5 rounded font-semibold">
<code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-semibold">
app/page.js
</code>
</li>
Expand All @@ -24,7 +24,7 @@ export default function Home() {

<div className="flex gap-4 items-center flex-col sm:flex-row">
<a
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-button-primary-hover text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
Expand All @@ -39,7 +39,7 @@ export default function Home() {
Deploy now
</a>
<a
className="rounded-full border border-solid border-gray-alpha-200 transition-colors flex items-center justify-center hover:bg-button-secondary-hover hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"
className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ module.exports = {
colors: {
background: "var(--background)",
foreground: "var(--foreground)",
"gray-rgb": "var(--gray-rgb)",
"gray-alpha-200": "var(--gray-alpha-200)",
"gray-alpha-100": "var(--gray-alpha-100)",
"button-primary-hover": "var(--button-primary-hover)",
"button-secondary-hover": "var(--button-secondary-hover)",
},
fontFamily: {
sans: ["var(--font-geist-sans)"],
Expand Down
15 changes: 1 addition & 14 deletions packages/create-next-app/templates/app-tw/ts/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,17 @@
:root {
--background: #ffffff;
--foreground: #171717;

--gray-rgb: 0, 0, 0;
--gray-alpha-200: rgba(var(--gray-rgb), 0.08);
--gray-alpha-100: rgba(var(--gray-rgb), 0.05);

--button-primary-hover: #383838;
--button-secondary-hover: #f2f2f2;
}

@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;

--gray-rgb: 255, 255, 255;
--gray-alpha-200: rgba(var(--gray-rgb), 0.145);
--gray-alpha-100: rgba(var(--gray-rgb), 0.06);

--button-primary-hover: #ccc;
--button-secondary-hover: #1a1a1a;
}
}

body {
color: var(--foreground);
background: var(--background);
font-synthesis: none;
}
6 changes: 3 additions & 3 deletions packages/create-next-app/templates/app-tw/ts/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function Home() {
<ol className="font-mono list-inside list-decimal text-sm text-center sm:text-left">
<li className="mb-2">
Get started by editing{" "}
<code className="bg-gray-alpha-100 px-1 py-0.5 rounded font-semibold">
<code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-semibold">
app/page.tsx
</code>
</li>
Expand All @@ -24,7 +24,7 @@ export default function Home() {

<div className="flex gap-4 items-center flex-col sm:flex-row">
<a
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-button-primary-hover text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
Expand All @@ -39,7 +39,7 @@ export default function Home() {
Deploy now
</a>
<a
className="rounded-full border border-solid border-gray-alpha-200 transition-colors flex items-center justify-center hover:bg-button-secondary-hover hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"
className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ const config: Config = {
colors: {
background: "var(--background)",
foreground: "var(--foreground)",
"gray-rgb": "var(--gray-rgb)",
"gray-alpha-200": "var(--gray-alpha-200)",
"gray-alpha-100": "var(--gray-alpha-100)",
"button-primary-hover": "var(--button-primary-hover)",
"button-secondary-hover": "var(--button-secondary-hover)",
},
fontFamily: {
sans: ["var(--font-geist-sans)"],
Expand Down
14 changes: 0 additions & 14 deletions packages/create-next-app/templates/app/js/app/globals.css
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
:root {
--background: #ffffff;
--foreground: #171717;

--gray-rgb: 0, 0, 0;
--gray-alpha-200: rgba(var(--gray-rgb), 0.08);
--gray-alpha-100: rgba(var(--gray-rgb), 0.05);

--button-primary-hover: #383838;
--button-secondary-hover: #f2f2f2;
}

@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;

--gray-rgb: 255, 255, 255;
--gray-alpha-200: rgba(var(--gray-rgb), 0.145);
--gray-alpha-100: rgba(var(--gray-rgb), 0.06);

--button-primary-hover: #ccc;
--button-secondary-hover: #1a1a1a;
}
}

Expand Down
19 changes: 19 additions & 0 deletions packages/create-next-app/templates/app/js/app/page.module.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
.page {
--gray-rgb: 0, 0, 0;
--gray-alpha-200: rgba(var(--gray-rgb), 0.08);
--gray-alpha-100: rgba(var(--gray-rgb), 0.05);

--button-primary-hover: #383838;
--button-secondary-hover: #f2f2f2;

display: grid;
grid-template-rows: 20px 1fr 20px;
align-items: center;
justify-items: center;
min-height: 100svh;
padding: 80px;
gap: 64px;
font-synthesis: none;
}

@media (prefers-color-scheme: dark) {
.page {
--gray-rgb: 255, 255, 255;
--gray-alpha-200: rgba(var(--gray-rgb), 0.145);
--gray-alpha-100: rgba(var(--gray-rgb), 0.06);

--button-primary-hover: #ccc;
--button-secondary-hover: #1a1a1a;
}
}

.main {
Expand Down
14 changes: 0 additions & 14 deletions packages/create-next-app/templates/app/ts/app/globals.css
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
:root {
--background: #ffffff;
--foreground: #171717;

--gray-rgb: 0, 0, 0;
--gray-alpha-200: rgba(var(--gray-rgb), 0.08);
--gray-alpha-100: rgba(var(--gray-rgb), 0.05);

--button-primary-hover: #383838;
--button-secondary-hover: #f2f2f2;
}

@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;

--gray-rgb: 255, 255, 255;
--gray-alpha-200: rgba(var(--gray-rgb), 0.145);
--gray-alpha-100: rgba(var(--gray-rgb), 0.06);

--button-primary-hover: #ccc;
--button-secondary-hover: #1a1a1a;
}
}

Expand Down
19 changes: 19 additions & 0 deletions packages/create-next-app/templates/app/ts/app/page.module.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
.page {
--gray-rgb: 0, 0, 0;
--gray-alpha-200: rgba(var(--gray-rgb), 0.08);
--gray-alpha-100: rgba(var(--gray-rgb), 0.05);

--button-primary-hover: #383838;
--button-secondary-hover: #f2f2f2;

display: grid;
grid-template-rows: 20px 1fr 20px;
align-items: center;
justify-items: center;
min-height: 100svh;
padding: 80px;
gap: 64px;
font-synthesis: none;
}

@media (prefers-color-scheme: dark) {
.page {
--gray-rgb: 255, 255, 255;
--gray-alpha-200: rgba(var(--gray-rgb), 0.145);
--gray-alpha-100: rgba(var(--gray-rgb), 0.06);

--button-primary-hover: #ccc;
--button-secondary-hover: #1a1a1a;
}
}

.main {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function Home() {
<ol className="font-mono list-inside list-decimal text-sm text-center sm:text-left">
<li className="mb-2">
Get started by editing{" "}
<code className="bg-gray-alpha-100 px-1 py-0.5 rounded font-semibold">
<code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-semibold">
pages/index.js
</code>
</li>
Expand All @@ -36,7 +36,7 @@ export default function Home() {

<div className="font-sans flex gap-4 items-center flex-col sm:flex-row">
<a
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-button-primary-hover text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
Expand All @@ -51,7 +51,7 @@ export default function Home() {
Deploy now
</a>
<a
className="rounded-full border border-solid border-gray-alpha-200 transition-colors flex items-center justify-center hover:bg-button-secondary-hover hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"
className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,17 @@
:root {
--background: #ffffff;
--foreground: #171717;

--gray-rgb: 0, 0, 0;
--gray-alpha-200: rgba(var(--gray-rgb), 0.08);
--gray-alpha-100: rgba(var(--gray-rgb), 0.05);

--button-primary-hover: #383838;
--button-secondary-hover: #f2f2f2;
}

@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;

--gray-rgb: 255, 255, 255;
--gray-alpha-200: rgba(var(--gray-rgb), 0.145);
--gray-alpha-100: rgba(var(--gray-rgb), 0.06);

--button-primary-hover: #ccc;
--button-secondary-hover: #1a1a1a;
}
}

body {
color: var(--foreground);
background: var(--background);
font-synthesis: none;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ module.exports = {
colors: {
background: "var(--background)",
foreground: "var(--foreground)",
"gray-rgb": "var(--gray-rgb)",
"gray-alpha-200": "var(--gray-alpha-200)",
"gray-alpha-100": "var(--gray-alpha-100)",
"button-primary-hover": "var(--button-primary-hover)",
"button-secondary-hover": "var(--button-secondary-hover)",
},
fontFamily: {
sans: ["var(--font-geist-sans)"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function Home() {
<ol className="font-mono list-inside list-decimal text-sm text-center sm:text-left">
<li className="mb-2">
Get started by editing{" "}
<code className="bg-gray-alpha-100 px-1 py-0.5 rounded font-semibold">
<code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-semibold">
pages/index.tsx
</code>
</li>
Expand All @@ -36,7 +36,7 @@ export default function Home() {

<div className="font-sans flex gap-4 items-center flex-col sm:flex-row">
<a
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-button-primary-hover text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
Expand All @@ -51,7 +51,7 @@ export default function Home() {
Deploy now
</a>
<a
className="rounded-full border border-solid border-gray-alpha-200 transition-colors flex items-center justify-center hover:bg-button-secondary-hover hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"
className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=default-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,17 @@
:root {
--background: #ffffff;
--foreground: #171717;

--gray-rgb: 0, 0, 0;
--gray-alpha-200: rgba(var(--gray-rgb), 0.08);
--gray-alpha-100: rgba(var(--gray-rgb), 0.05);

--button-primary-hover: #383838;
--button-secondary-hover: #f2f2f2;
}

@media (prefers-color-scheme: dark) {
:root {
--background: #0a0a0a;
--foreground: #ededed;

--gray-rgb: 255, 255, 255;
--gray-alpha-200: rgba(var(--gray-rgb), 0.145);
--gray-alpha-100: rgba(var(--gray-rgb), 0.06);

--button-primary-hover: #ccc;
--button-secondary-hover: #1a1a1a;
}
}

body {
color: var(--foreground);
background: var(--background);
font-synthesis: none;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ const config: Config = {
colors: {
background: "var(--background)",
foreground: "var(--foreground)",
"gray-rgb": "var(--gray-rgb)",
"gray-alpha-200": "var(--gray-alpha-200)",
"gray-alpha-100": "var(--gray-alpha-100)",
"button-primary-hover": "var(--button-primary-hover)",
"button-secondary-hover": "var(--button-secondary-hover)",
},
fontFamily: {
sans: ["var(--font-geist-sans)"],
Expand Down
Loading

0 comments on commit a38caf4

Please sign in to comment.