Skip to content

Commit 036c7bb

Browse files
committed
chore(examples): update mlaursen examples
1 parent 9f5fc2f commit 036c7bb

File tree

12 files changed

+95
-48
lines changed

12 files changed

+95
-48
lines changed

examples/mlaursen-nextjs/.lazy.lua

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,39 @@ return {
1010
},
1111
},
1212
},
13+
{
14+
"neovim/nvim-lspconfig",
15+
opts = {
16+
servers = {
17+
vtsls = {
18+
settings = {
19+
typescript = {
20+
preferences = {
21+
autoImportSpecifierExcludeRegexes = {
22+
-- i normally want vitest or jest instead
23+
"^node:test$",
24+
25+
-- require `node:` for the core modules
26+
"^(child_process|fs|path)$",
27+
28+
-- I don't need node internals for 99% of my projects, so remove from auto-imports and suggestions
29+
"^(node:)?(assert|async_hooks|buffer|cluster|console|constants|crypto|dgram|diagnostics_channel|dns|domain|events|http|http2|https|inspector|module|net|os|perf_hooks|process|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|trace_events|tty|url|util|v8|vm|wasi|worker_threads|zlib)",
30+
31+
-- I don't need imports from these most of the time
32+
"^(node_modules/|next/dist/|typescript)",
33+
34+
-- use my custom Link instead
35+
"^next/link.js$",
36+
"^@react-md/core/link/Link$",
37+
38+
-- use app dir imports
39+
"^next/(document|head|router|form).js$",
40+
},
41+
},
42+
},
43+
},
44+
},
45+
},
46+
},
47+
},
1348
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
@use "sass:string";
12
@use "@react-md/core/a11y";
23
@use "@react-md/core/colors";
34

45
@forward "@react-md/core" with (
56
$color-scheme: system,
67
$primary-color: colors.$teal-500,
78
$secondary-color: colors.$pink-a-200,
9+
$font-family: var(--roboto-, string.unquote("Roboto, Arial, sans-serif")),
810
$icon-disable-font: true,
11+
$icon-disable-svg: true,
912
$disable-rtl: true
1013
);

examples/mlaursen-nextjs/eslint.config.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
// @ts-check
22
import { FlatCompat } from "@eslint/eslintrc";
3-
import { config, configs, gitignore } from "@mlaursen/eslint-config";
3+
import { configs, defineConfig, gitignore } from "@mlaursen/eslint-config";
44

55
const compat = new FlatCompat({
66
baseDirectory: import.meta.dirname,
77
});
88

9-
export default config(
9+
export default defineConfig(
1010
gitignore(import.meta.url),
11+
// @ts-expect-error some eslint typedef mismatch
1112
...compat.config({
1213
// extends: ["plugin:@next/next/recommended"],
1314
extends: ["plugin:@next/next/core-web-vitals"],

examples/mlaursen-nextjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"@eslint/eslintrc": "^3.3.1",
3434
"@jest/globals": "^29.7.0",
3535
"@jest/types": "^29.6.3",
36-
"@mlaursen/eslint-config": "^8.0.0",
36+
"@mlaursen/eslint-config": "^9.0.2",
3737
"@next/eslint-plugin-next": "^15.3.1",
3838
"@swc/core": "^1.11.21",
3939
"@testing-library/dom": "^10.4.0",

examples/mlaursen-nextjs/src/app/app.scss

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@use "everything" as *;
2+
3+
@include styles;

examples/mlaursen-nextjs/src/app/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { type ReactElement, type ReactNode } from "react";
55
import { RootLayout } from "@/components/RootLayout.jsx";
66
import { RootProviders } from "@/components/RootProviders.jsx";
77

8-
import "./app.scss";
8+
import "./layout.scss";
9+
import "./symbols.scss";
910

1011
const roboto = Roboto_Flex({
1112
subsets: ["latin"],
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@use "everything" as *;
2+
3+
@import url("https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200");
4+
5+
[class*="material-"] {
6+
@include icon-use-var(font-size, size);
7+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import Link, { type LinkProps } from "next/link.js";
2+
import { type AnchorHTMLAttributes, type ReactNode } from "react";
3+
4+
export interface LinkUnstyledProps
5+
extends LinkProps,
6+
AnchorHTMLAttributes<HTMLAnchorElement> {
7+
href: string;
8+
children: ReactNode;
9+
}
10+
11+
export function LinkUnstyled(props: Readonly<LinkUnstyledProps>): ReactElement {
12+
if (props.href.startsWith("https://") || props.href.endsWith(".html")) {
13+
// eslint-disable-next-line jsx-a11y/anchor-has-content
14+
return <a {...props} ref={ref} />;
15+
}
16+
17+
return <Link {...props} ref={ref} />;
18+
}

examples/mlaursen-nextjs/src/rmdConfig.tsx

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,29 @@
11
"use client";
22

33
import { type ReactMDCoreConfiguration } from "@react-md/core/CoreProviders";
4+
import { MaterialSymbol } from "@react-md/core/icon/MaterialSymbol";
45
import { configureIcons } from "@react-md/core/icon/config";
5-
import ArrowDropDownIcon from "@react-md/material-icons/ArrowDropDownIcon";
6-
import ArrowUpwardIcon from "@react-md/material-icons/ArrowUpwardIcon";
7-
import CancelIcon from "@react-md/material-icons/CancelIcon";
8-
import CheckBoxIcon from "@react-md/material-icons/CheckBoxIcon";
9-
import CheckBoxOutlineBlankIcon from "@react-md/material-icons/CheckBoxOutlineBlankIcon";
10-
import CheckIcon from "@react-md/material-icons/CheckIcon";
11-
import ClearIcon from "@react-md/material-icons/ClearIcon";
12-
import CloseIcon from "@react-md/material-icons/CloseIcon";
13-
import ErrorOutlineIcon from "@react-md/material-icons/ErrorOutlineIcon";
14-
import FileUploadIcon from "@react-md/material-icons/FileUploadIcon";
15-
import IndeterminateCheckBoxIcon from "@react-md/material-icons/IndeterminateCheckBoxIcon";
16-
import KeyboardArrowDownIcon from "@react-md/material-icons/KeyboardArrowDownIcon";
17-
import KeyboardArrowLeftIcon from "@react-md/material-icons/KeyboardArrowLeftIcon";
18-
import KeyboardArrowRightIcon from "@react-md/material-icons/KeyboardArrowRightIcon";
19-
import MenuIcon from "@react-md/material-icons/MenuIcon";
20-
import NotificationsIcon from "@react-md/material-icons/NotificationsIcon";
21-
import RadioButtonCheckedIcon from "@react-md/material-icons/RadioButtonCheckedIcon";
22-
import RadioButtonUncheckedIcon from "@react-md/material-icons/RadioButtonUncheckedIcon";
23-
import RemoveRedEyeIcon from "@react-md/material-icons/RemoveRedEyeIcon";
246

257
configureIcons({
26-
back: <KeyboardArrowLeftIcon />,
27-
clear: <ClearIcon />,
28-
close: <CloseIcon />,
29-
checkbox: <CheckBoxOutlineBlankIcon />,
30-
checkboxChecked: <CheckBoxIcon />,
31-
checkboxIndeterminate: <IndeterminateCheckBoxIcon />,
32-
dropdown: <ArrowDropDownIcon />,
33-
error: <ErrorOutlineIcon />,
34-
expander: <KeyboardArrowDownIcon />,
35-
forward: <KeyboardArrowRightIcon />,
36-
menu: <MenuIcon />,
37-
notification: <NotificationsIcon />,
38-
password: <RemoveRedEyeIcon />,
39-
radio: <RadioButtonUncheckedIcon />,
40-
radioChecked: <RadioButtonCheckedIcon />,
41-
remove: <CancelIcon />,
42-
selected: <CheckIcon />,
43-
sort: <ArrowUpwardIcon />,
44-
upload: <FileUploadIcon />,
8+
back: <MaterialSymbol name="keyboard_arrow_left" />,
9+
clear: <MaterialSymbol name="close_small" />,
10+
close: <MaterialSymbol name="close" />,
11+
checkbox: <MaterialSymbol name="check_box_outline_blank" />,
12+
checkboxChecked: <MaterialSymbol name="check_box" />,
13+
checkboxIndeterminate: <MaterialSymbol name="indeterminate_check_box" />,
14+
dropdown: <MaterialSymbol name="arrow_drop_down" />,
15+
error: <MaterialSymbol name="error" />,
16+
expander: <MaterialSymbol name="keyboard_arrow_down" />,
17+
forward: <MaterialSymbol name="keyboard_arrow_right" />,
18+
menu: <MaterialSymbol name="menu" />,
19+
notification: <MaterialSymbol name="notifications" />,
20+
password: <MaterialSymbol name="visibility" />,
21+
radio: <MaterialSymbol name="radio_button_unchecked" />,
22+
radioChecked: <MaterialSymbol name="radio_button_checked" />,
23+
remove: <MaterialSymbol name="cancel" />,
24+
selected: <MaterialSymbol name="check" />,
25+
sort: <MaterialSymbol name="arrow_upward" />,
26+
upload: <MaterialSymbol name="upload" />,
4527
});
4628

4729
export const rmdConfig: ReactMDCoreConfiguration = {

0 commit comments

Comments
 (0)