Skip to content

Commit 4870677

Browse files
authored
Merge branch 'main' into feat/add-drizzle
2 parents 1a8cddf + 92a17e8 commit 4870677

File tree

19 files changed

+472
-68
lines changed

19 files changed

+472
-68
lines changed

.github/workflows/no-response.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: 🥺 Handle Ghosting
18-
uses: actions/stale@v8
18+
uses: actions/stale@v9
1919
with:
2020
days-before-close: 21
2121
# don't automatically mark issues/PRs as stale

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ You can also initialize a new project with any of these examples using the `--te
1313
For example:
1414

1515
```
16-
npx create-remix@latest --template examples/<example-dir>
16+
npx create-remix@latest --template remix-run/examples/<example-dir>
1717
```
1818

1919
Enjoy!

dark-mode/app/routes/action.set-theme.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type { ActionArgs } from "@remix-run/node";
1+
import type { ActionFunctionArgs } from "@remix-run/node";
22
import { json, redirect } from "@remix-run/node";
33

44
import { isTheme } from "~/utils/theme-provider";
55
import { getThemeSession } from "~/utils/theme.server";
66

7-
export const action = async ({ request }: ActionArgs) => {
7+
export const action = async ({ request }: ActionFunctionArgs) => {
88
const themeSession = await getThemeSession(request);
99
const requestText = await request.text();
1010
const form = new URLSearchParams(requestText);

dataloader/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Open this example on [CodeSandbox](https://codesandbox.com):
1717

1818
`app/data.server.ts` implements the `db` object which mimics an ORM in the style of [Prisma](https://www.prisma.io/). The method `db.user#findMany` logs _user#findMany_ to the console, for demo purposes.
1919

20-
There's exactly one DataLoader factory `createUsersByIdLoader`, implemented in `app/loaders/userLoader.ts`. It's put on context of [createRequestHandler](https://remix.run/other-api/adapter#createrequesthandler) in `server/index.ts` as `usersById` which is made available to all Remix-loaders and -actions. Both the loaders of `app/routes/users.tsx` and `app/routes/users/_index.tsx` make calls to this loader. When inspecting the server logs while refreshing the page, you'll notice that there's only one log _user#findMany_ per request, proving that with this implementation, there's only one rountrip to the database.
20+
There's exactly one DataLoader factory `createUsersByIdLoader`, implemented in `app/loaders/userLoader.ts`. It's put on context of [createRequestHandler](https://remix.run/other-api/adapter#createrequesthandler) in `server/index.ts` as `usersById` which is made available to all Remix-loaders and -actions. Both the loaders of `app/routes/users.tsx` and `app/routes/users/_index.tsx` make calls to this loader. When inspecting the server logs while refreshing the page, you'll notice that there's only one log _user#findMany_ per request, proving that with this implementation, there's only one roundtrip to the database.
2121

2222
## Related Links
2323

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@
99
},
1010
"devDependencies": {
1111
"@remix-run/eslint-config": "^1.19.3",
12-
"@types/react": "^18.2.39",
13-
"eslint": "^8.54.0",
14-
"eslint-config-prettier": "^9.0.0",
12+
"@types/react": "^18.3.2",
13+
"eslint": "^8.57.0",
14+
"eslint-config-prettier": "^9.1.0",
1515
"eslint-plugin-markdown": "^3.0.1",
16-
"eslint-plugin-cypress": "^2.15.1",
16+
"eslint-plugin-cypress": "^3.0.3",
1717
"eslint-plugin-prefer-let": "^3.0.1",
1818
"jest": "^29.7.0",
19-
"prettier": "^3.1.0",
20-
"react": "^18.2.0",
21-
"typescript": "^5.3.2"
19+
"prettier": "^3.2.5",
20+
"react": "^18.3.1",
21+
"typescript": "^5.4.5"
2222
},
2323
"engines": {
2424
"node": ">=14.0.0"

yarn.lock

Lines changed: 50 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,10 @@
384384
resolved "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.6.2.tgz#1816b5f6948029c5eaacb0703b850ee0cb37d8f8"
385385
integrity sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw==
386386

387-
"@eslint/eslintrc@^2.1.3":
388-
version "2.1.3"
389-
resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.3.tgz#797470a75fe0fbd5a53350ee715e85e87baff22d"
390-
integrity sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==
387+
"@eslint/eslintrc@^2.1.4":
388+
version "2.1.4"
389+
resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad"
390+
integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==
391391
dependencies:
392392
ajv "^6.12.4"
393393
debug "^4.3.2"
@@ -399,29 +399,29 @@
399399
minimatch "^3.1.2"
400400
strip-json-comments "^3.1.1"
401401

402-
"@eslint/js@8.54.0":
403-
version "8.54.0"
404-
resolved "https://registry.npmjs.org/@eslint/js/-/js-8.54.0.tgz#4fab9a2ff7860082c304f750e94acd644cf984cf"
405-
integrity sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==
402+
"@eslint/js@8.57.0":
403+
version "8.57.0"
404+
resolved "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz#a5417ae8427873f1dd08b70b3574b453e67b5f7f"
405+
integrity sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==
406406

407-
"@humanwhocodes/config-array@^0.11.13":
408-
version "0.11.13"
409-
resolved "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz#075dc9684f40a531d9b26b0822153c1e832ee297"
410-
integrity sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==
407+
"@humanwhocodes/config-array@^0.11.14":
408+
version "0.11.14"
409+
resolved "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz#d78e481a039f7566ecc9660b4ea7fe6b1fec442b"
410+
integrity sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==
411411
dependencies:
412-
"@humanwhocodes/object-schema" "^2.0.1"
413-
debug "^4.1.1"
412+
"@humanwhocodes/object-schema" "^2.0.2"
413+
debug "^4.3.1"
414414
minimatch "^3.0.5"
415415

416416
"@humanwhocodes/module-importer@^1.0.1":
417417
version "1.0.1"
418418
resolved "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c"
419419
integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==
420420

421-
"@humanwhocodes/object-schema@^2.0.1":
422-
version "2.0.1"
423-
resolved "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz#e5211452df060fa8522b55c7b3c0c4d1981cb044"
424-
integrity sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==
421+
"@humanwhocodes/object-schema@^2.0.2":
422+
version "2.0.2"
423+
resolved "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz#d9fae00a2d5cb40f92cfe64b47ad749fbc38f917"
424+
integrity sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==
425425

426426
"@istanbuljs/load-nyc-config@^1.0.0":
427427
version "1.1.0"
@@ -862,20 +862,14 @@
862862
resolved "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz#5f19d2b85a98e9558036f6a3cacc8819420f05cf"
863863
integrity sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==
864864

865-
"@types/react@^18.2.39":
866-
version "18.2.39"
867-
resolved "https://registry.npmjs.org/@types/react/-/react-18.2.39.tgz#744bee99e053ad61fe74eb8b897f3ab5b19a7e25"
868-
integrity sha512-Oiw+ppED6IremMInLV4HXGbfbG6GyziY3kqAwJYOR0PNbkYDmLWQA3a95EhdSmamsvbkJN96ZNN+YD+fGjzSBA==
865+
"@types/react@^18.3.2":
866+
version "18.3.2"
867+
resolved "https://registry.npmjs.org/@types/react/-/react-18.3.2.tgz#462ae4904973bc212fa910424d901e3d137dbfcd"
868+
integrity sha512-Btgg89dAnqD4vV7R3hlwOxgqobUQKgx3MmrQRi0yYbs/P0ym8XozIAlkqVilPqHQwXs4e9Tf63rrCgl58BcO4w==
869869
dependencies:
870870
"@types/prop-types" "*"
871-
"@types/scheduler" "*"
872871
csstype "^3.0.2"
873872

874-
"@types/scheduler@*":
875-
version "0.16.3"
876-
resolved "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.3.tgz#cef09e3ec9af1d63d2a6cc5b383a737e24e6dcf5"
877-
integrity sha512-5cJ8CB4yAx7BH1oMvdU0Jh9lrEXyPkar6F9G/ERswkCuvP4KQZfZkSjcMbAICCpQTN4OuZn8tz0HiKv9TGZgrQ==
878-
879873
"@types/semver@^7.3.12":
880874
version "7.3.13"
881875
resolved "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91"
@@ -1421,7 +1415,7 @@ debug@^3.2.7:
14211415
dependencies:
14221416
ms "^2.1.1"
14231417

1424-
debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4:
1418+
debug@^4.0.0, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4:
14251419
version "4.3.4"
14261420
resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
14271421
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
@@ -1650,10 +1644,10 @@ escape-string-regexp@^4.0.0:
16501644
resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
16511645
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
16521646

1653-
eslint-config-prettier@^9.0.0:
1654-
version "9.0.0"
1655-
resolved "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.0.0.tgz#eb25485946dd0c66cd216a46232dc05451518d1f"
1656-
integrity sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw==
1647+
eslint-config-prettier@^9.1.0:
1648+
version "9.1.0"
1649+
resolved "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f"
1650+
integrity sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==
16571651

16581652
[email protected], eslint-import-resolver-node@^0.3.7:
16591653
version "0.3.7"
@@ -1685,10 +1679,10 @@ eslint-module-utils@^2.7.4:
16851679
dependencies:
16861680
debug "^3.2.7"
16871681

1688-
eslint-plugin-cypress@^2.15.1:
1689-
version "2.15.1"
1690-
resolved "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-2.15.1.tgz#336afa7e8e27451afaf65aa359c9509e0a4f3a7b"
1691-
integrity sha512-eLHLWP5Q+I4j2AWepYq0PgFEei9/s5LvjuSqWrxurkg1YZ8ltxdvMNmdSf0drnsNo57CTgYY/NIHHLRSWejR7w==
1682+
eslint-plugin-cypress@^3.0.3:
1683+
version "3.0.3"
1684+
resolved "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-3.0.3.tgz#5a8f226e81276edca9fa17b24a4b9cb358a41936"
1685+
integrity sha512-yrdAyBoHRCarLrlozReLAuRn/AXQPqWf7+HoXzWLFAH7ntqn1RLpBqi2Vl7Czl2Y1pWNFVpXJlFeNj5dmUslsg==
16921686
dependencies:
16931687
globals "^13.20.0"
16941688

@@ -1856,16 +1850,16 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4
18561850
resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800"
18571851
integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==
18581852

1859-
eslint@^8.54.0:
1860-
version "8.54.0"
1861-
resolved "https://registry.npmjs.org/eslint/-/eslint-8.54.0.tgz#588e0dd4388af91a2e8fa37ea64924074c783537"
1862-
integrity sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA==
1853+
eslint@^8.57.0:
1854+
version "8.57.0"
1855+
resolved "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz#c786a6fd0e0b68941aaf624596fb987089195668"
1856+
integrity sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==
18631857
dependencies:
18641858
"@eslint-community/eslint-utils" "^4.2.0"
18651859
"@eslint-community/regexpp" "^4.6.1"
1866-
"@eslint/eslintrc" "^2.1.3"
1867-
"@eslint/js" "8.54.0"
1868-
"@humanwhocodes/config-array" "^0.11.13"
1860+
"@eslint/eslintrc" "^2.1.4"
1861+
"@eslint/js" "8.57.0"
1862+
"@humanwhocodes/config-array" "^0.11.14"
18691863
"@humanwhocodes/module-importer" "^1.0.1"
18701864
"@nodelib/fs.walk" "^1.2.8"
18711865
"@ungap/structured-clone" "^1.2.0"
@@ -3443,10 +3437,10 @@ prelude-ls@^1.2.1:
34433437
resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
34443438
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==
34453439

3446-
prettier@^3.1.0:
3447-
version "3.1.0"
3448-
resolved "https://registry.npmjs.org/prettier/-/prettier-3.1.0.tgz#c6d16474a5f764ea1a4a373c593b779697744d5e"
3449-
integrity sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==
3440+
prettier@^3.2.5:
3441+
version "3.2.5"
3442+
resolved "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368"
3443+
integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==
34503444

34513445
pretty-format@^27.0.2:
34523446
version "27.5.1"
@@ -3513,10 +3507,10 @@ react-is@^18.0.0:
35133507
resolved "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
35143508
integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==
35153509

3516-
react@^18.2.0:
3517-
version "18.2.0"
3518-
resolved "https://registry.npmjs.org/react/-/react-18.2.0.tgz#555bd98592883255fa00de14f1151a917b5d77d5"
3519-
integrity sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==
3510+
react@^18.3.1:
3511+
version "18.3.1"
3512+
resolved "https://registry.npmjs.org/react/-/react-18.3.1.tgz#49ab892009c53933625bd16b2533fc754cab2891"
3513+
integrity sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==
35203514
dependencies:
35213515
loose-envify "^1.1.0"
35223516

@@ -3923,10 +3917,10 @@ typed-array-length@^1.0.4:
39233917
for-each "^0.3.3"
39243918
is-typed-array "^1.1.9"
39253919

3926-
typescript@^5.3.2:
3927-
version "5.3.2"
3928-
resolved "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz#00d1c7c1c46928c5845c1ee8d0cc2791031d4c43"
3929-
integrity sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==
3920+
typescript@^5.4.5:
3921+
version "5.4.5"
3922+
resolved "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611"
3923+
integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==
39303924

39313925
unbox-primitive@^1.0.2:
39323926
version "1.0.2"

zerops-example/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
3+
/.cache
4+
/build
5+
.env

zerops-example/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Zerops + Remix - Nodejs - [Preview](https://remixrun.zerops.dev/)
2+
3+
![Header Image](header.png)
4+
5+
A nodejs Remix example for Zerops which you can deploy in 2 simple steps.
6+
7+
## Instructions to Deploy on Zerops
8+
9+
1. Navigate to the Zerops Dashboard and locate the import project button on the sidebar.
10+
11+
2. Paste the Project Yaml
12+
13+
```yaml
14+
project:
15+
name: zerops-remix
16+
17+
services:
18+
- hostname: remixnode
19+
type: nodejs@18
20+
buildFromGit: https://github.com/fxck/zerops-remix-nodejs
21+
ports:
22+
- port: 3000
23+
httpSupport: true
24+
enableSubdomainAccess: true
25+
minContainers: 1
26+
```
27+
28+
If you still find yourself stuck in the process join our [Discord community](https://discord.gg/5ptAqtpyvh).
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
"use client";
2+
3+
import { useState } from "react";
4+
5+
const CopyIcon = () => (
6+
<svg
7+
xmlns="http://www.w3.org/2000/svg"
8+
width="20"
9+
height="20"
10+
viewBox="0 0 24 24"
11+
fill="none"
12+
stroke="currentColor"
13+
strokeWidth="2"
14+
strokeLinecap="round"
15+
strokeLinejoin="round"
16+
>
17+
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>
18+
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>
19+
</svg>
20+
);
21+
22+
const CheckIcon = () => (
23+
<svg
24+
xmlns="http://www.w3.org/2000/svg"
25+
width="20"
26+
height="20"
27+
viewBox="0 0 24 24"
28+
fill="none"
29+
stroke="currentColor"
30+
strokeWidth="2"
31+
strokeLinecap="round"
32+
strokeLinejoin="round"
33+
>
34+
<polyline points="20 6 9 17 4 12"></polyline>
35+
</svg>
36+
);
37+
38+
export function Code({ code }: { code: string }) {
39+
const [icon, setIcon] = useState(CopyIcon);
40+
41+
const copy = async () => {
42+
await navigator?.clipboard?.writeText(code);
43+
setIcon(CheckIcon);
44+
setTimeout(() => setIcon(CopyIcon), 2000);
45+
};
46+
47+
return (
48+
<pre>
49+
<code>{code}</code>
50+
<button onClick={copy}>{icon}</button>
51+
</pre>
52+
);
53+
}

zerops-example/app/root.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import {
2+
Links,
3+
Meta,
4+
Outlet,
5+
Scripts,
6+
ScrollRestoration,
7+
} from "@remix-run/react";
8+
9+
import styles from "./styles/main.css?url";
10+
11+
export const links = () => {
12+
return [{ rel: "stylesheet", href: styles }];
13+
};
14+
15+
export function Layout({ children }: { children: React.ReactNode }) {
16+
return (
17+
<html lang="en">
18+
<head>
19+
<meta charSet="utf-8" />
20+
<meta name="viewport" content="width=device-width, initial-scale=1" />
21+
<Meta />
22+
<Links />
23+
</head>
24+
<body className="font-opensans">
25+
{children}
26+
<ScrollRestoration />
27+
<Scripts />
28+
</body>
29+
</html>
30+
);
31+
}
32+
33+
export default function App() {
34+
return <Outlet />;
35+
}

0 commit comments

Comments
 (0)