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

refactor: [M3-8746] – Move inputMaxWidth into Theme #11116

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { inputMaxWidth } from '@linode/ui';
import React from 'react';
import { Controller, useFormContext, useWatch } from 'react-hook-form';

Expand Down Expand Up @@ -56,7 +55,11 @@ export const Security = () => {
Security
</Typography>
<React.Suspense
fallback={<Skeleton sx={{ height: '89px', maxWidth: inputMaxWidth }} />}
fallback={
<Skeleton
sx={(theme) => ({ height: '89px', maxWidth: theme.inputMaxWidth })}
/>
}
>
<Controller
render={({ field, fieldState }) => (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { inputMaxWidth } from '@linode/ui';
import React, { useState } from 'react';
import { Controller, useFormContext, useWatch } from 'react-hook-form';

Expand Down Expand Up @@ -133,7 +132,9 @@ export const VPC = () => {
}}
textFieldProps={{
sx: (theme) => ({
[theme.breakpoints.up('sm')]: { minWidth: inputMaxWidth },
[theme.breakpoints.up('sm')]: {
minWidth: theme.inputMaxWidth,
},
}),
tooltipText: REGION_CAVEAT_HELPER_TEXT,
}}
Expand Down
5 changes: 5 additions & 0 deletions packages/ui/.changeset/pr-11116-changed-1729114321677.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/ui": Changed
---

Moved `inputMaxWidth` into `Theme` ([#11116](https://github.com/linode/manager/pull/11116))
5 changes: 3 additions & 2 deletions packages/ui/src/foundations/themes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createTheme } from '@mui/material/styles';

// Themes & Brands
import { darkTheme } from './dark';
import { lightTheme, inputMaxWidth as _inputMaxWidth } from './light';
import { lightTheme } from './light';

import type {
ChartTypes,
Expand Down Expand Up @@ -76,6 +76,7 @@ declare module '@mui/material/styles/createTheme' {
color: Colors;
font: Fonts;
graphs: any;
inputMaxWidth: number;
inputStyles: any;
interactionTokens: InteractionTypes;
name: ThemeName;
Expand All @@ -96,6 +97,7 @@ declare module '@mui/material/styles/createTheme' {
color?: DarkModeColors | LightModeColors;
font?: Fonts;
graphs?: any;
inputMaxWidth?: number;
inputStyles?: any;
interactionTokens?: InteractionTypes;
name: ThemeName;
Expand All @@ -105,6 +107,5 @@ declare module '@mui/material/styles/createTheme' {
}
}

export const inputMaxWidth = _inputMaxWidth;
export const light = createTheme(lightTheme);
export const dark = createTheme(lightTheme, darkTheme);
3 changes: 2 additions & 1 deletion packages/ui/src/foundations/themes/light.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { latoWeb } from '../fonts';

import type { ThemeOptions } from '@mui/material/styles';

export const inputMaxWidth = 416;
const inputMaxWidth = 416;

export const bg = {
app: Color.Neutrals[5],
Expand Down Expand Up @@ -1526,6 +1526,7 @@ export const lightTheme: ThemeOptions = {
},
yellow: `rgba(255, 220, 125, ${graphTransparency})`,
},
inputMaxWidth,
inputStyles: {
default: {
backgroundColor: Select.Default.Background,
Expand Down