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

[examples] Use CSS Variables #43856

Merged
merged 5 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
1 change: 1 addition & 0 deletions examples/material-ui-cra-tailwind-ts/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const root = ReactDOM.createRoot(rootElement!);
// All `Portal`-related components need to have the the main app wrapper element as a container
// so that the are in the subtree under the element used in the `important` option of the Tailwind's config.
const theme = createTheme({
cssVariables: true,
components: {
MuiPopover: {
defaultProps: {
Expand Down
16 changes: 8 additions & 8 deletions examples/material-ui-cra-tailwind-ts/src/reportWebVitals.ts
Juneezee marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ReportHandler } from 'web-vitals';
import { MetricType } from 'web-vitals';

const reportWebVitals = (onPerfEntry?: ReportHandler) => {
const reportWebVitals = (onPerfEntry?: (metric: MetricType) => void) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
import('web-vitals').then(({ onCLS, onINP, onFCP, onLCP, onTTFB }) => {
onCLS(onPerfEntry);
onINP(onPerfEntry);
onFCP(onPerfEntry);
onLCP(onPerfEntry);
onTTFB(onPerfEntry);
});
}
};
Expand Down
1 change: 1 addition & 0 deletions examples/material-ui-cra-ts/src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { red } from '@mui/material/colors';

// A custom theme for this app
const theme = createTheme({
cssVariables: true,
palette: {
primary: {
main: '#556cd6',
Expand Down
1 change: 1 addition & 0 deletions examples/material-ui-cra/src/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createTheme } from '@mui/material/styles';

// A custom theme for this app
const theme = createTheme({
cssVariables: true,
palette: {
primary: {
main: '#556cd6',
Expand Down
1 change: 1 addition & 0 deletions examples/material-ui-express-ssr/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { red } from '@mui/material/colors';

// Create a theme instance.
const theme = createTheme({
cssVariables: true,
palette: {
primary: {
main: '#556cd6',
Expand Down
1 change: 1 addition & 0 deletions examples/material-ui-gatsby/src/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { createTheme } from '@mui/material/styles';

// A custom theme for this app
const theme = createTheme({
cssVariables: true,
palette: {
primary: {
main: '#556cd6',
Expand Down
1 change: 1 addition & 0 deletions examples/material-ui-nextjs-pages-router-ts/src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const roboto = Roboto({

// Create a theme instance.
const theme = createTheme({
cssVariables: true,
palette: {
primary: {
main: '#556cd6',
Expand Down
1 change: 1 addition & 0 deletions examples/material-ui-nextjs-pages-router/src/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const roboto = Roboto({

// Create a theme instance.
const theme = createTheme({
cssVariables: true,
palette: {
primary: {
main: '#556cd6',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const roboto = Roboto({

// Create a theme instance.
const theme = createTheme({
cssVariables: true,
palette: {
primary: {
main: '#556cd6',
Expand Down
16 changes: 11 additions & 5 deletions examples/material-ui-nextjs-ts/src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const roboto = Roboto({
});

const theme = createTheme({
cssVariables: true,
palette: {
mode: 'light',
},
Expand All @@ -18,11 +19,16 @@ const theme = createTheme({
components: {
MuiAlert: {
styleOverrides: {
root: ({ ownerState }) => ({
...(ownerState.severity === 'info' && {
backgroundColor: '#60a5fa',
}),
}),
root: {
variants: [
{
props: { severity: 'info' },
style: {
backgroundColor: '#60a5fa',
},
}
],
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks.

},
},
},
Expand Down
16 changes: 11 additions & 5 deletions examples/material-ui-nextjs/src/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const roboto = Roboto({
});

const theme = createTheme({
cssVariables: true,
palette: {
mode: 'light',
},
Expand All @@ -18,11 +19,16 @@ const theme = createTheme({
components: {
MuiAlert: {
styleOverrides: {
root: ({ ownerState }) => ({
...(ownerState.severity === 'info' && {
backgroundColor: '#60a5fa',
}),
}),
root: {
variants: [
{
props: { severity: 'info' },
style: {
backgroundColor: '#60a5fa',
},
}
],
},
},
},
},
Expand Down
1 change: 1 addition & 0 deletions examples/material-ui-preact/src/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { red } from '@mui/material/colors';

// Create a theme instance.
const theme = createTheme({
cssVariables: true,
palette: {
primary: {
main: '#556cd6',
Expand Down
1 change: 1 addition & 0 deletions examples/material-ui-remix-ts/app/src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { red } from '@mui/material/colors';

// Create a theme instance.
const theme = createTheme({
cssVariables: true,
palette: {
primary: {
main: '#556cd6',
Expand Down
1 change: 1 addition & 0 deletions examples/material-ui-via-cdn/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

// Create a theme instance.
const theme = createTheme({
cssVariables: true,
palette: {
primary: {
main: '#556cd6',
Expand Down
1 change: 1 addition & 0 deletions examples/material-ui-vite-ts/src/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { red } from '@mui/material/colors';

// A custom theme for this app
const theme = createTheme({
cssVariables: true,
palette: {
primary: {
main: '#556cd6',
Expand Down
1 change: 1 addition & 0 deletions examples/material-ui-vite/src/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { red } from '@mui/material/colors';

// Create a theme instance.
const theme = createTheme({
cssVariables: true,
palette: {
primary: {
main: '#556cd6',
Expand Down