Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd49898c

Browse files
committed
emotion:Section
1 parent9924a32 commitd49898c

File tree

1 file changed

+16
-22
lines changed

1 file changed

+16
-22
lines changed

‎site/src/components/SettingsLayout/Section.tsx

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import{makeStyles}from"@mui/styles";
1+
import{useTheme}from"@emotion/react";
22
importTypographyfrom"@mui/material/Typography";
3-
import{FC,ReactNode,PropsWithChildren}from"react";
3+
import{typeFC,typeReactNode,typePropsWithChildren}from"react";
44
import{SectionAction}from"./SectionAction";
5+
import{typeInterpolation,typeTheme}from"@emotion/react";
56

67
typeSectionLayout="fixed"|"fluid";
78

@@ -31,31 +32,30 @@ export const Section: SectionFC = ({
3132
children,
3233
layout="fixed",
3334
})=>{
34-
conststyles=useStyles({ layout});
35+
consttheme=useTheme();
36+
3537
return(
3638
<sectionclassName={className}id={id}data-testid={id}>
37-
<divclassName={styles.inner}>
39+
<divcss={{maxWidth:layout==="fluid" ?"100%" :500}}>
3840
{(title||description)&&(
39-
<divclassName={styles.header}>
41+
<divcss={styles.header}>
4042
<div>
4143
{title&&(
4244
<Typographyvariant="h4"sx={{fontSize:24}}>
4345
{title}
4446
</Typography>
4547
)}
4648
{description&&typeofdescription==="string"&&(
47-
<TypographyclassName={styles.description}>
48-
{description}
49-
</Typography>
49+
<Typographycss={styles.description}>{description}</Typography>
5050
)}
5151
{description&&typeofdescription!=="string"&&(
52-
<divclassName={styles.description}>{description}</div>
52+
<divcss={styles.description}>{description}</div>
5353
)}
5454
</div>
5555
{toolbar&&<div>{toolbar}</div>}
5656
</div>
5757
)}
58-
{alert&&<divclassName={styles.alert}>{alert}</div>}
58+
{alert&&<divcss={{marginBottom:theme.spacing(1)}}>{alert}</div>}
5959
{children}
6060
</div>
6161
</section>
@@ -65,23 +65,17 @@ export const Section: SectionFC = ({
6565
// Sub-components
6666
Section.Action=SectionAction;
6767

68-
constuseStyles=makeStyles((theme)=>({
69-
inner:({ layout}:{layout:SectionLayout})=>({
70-
maxWidth:layout==="fluid" ?"100%" :500,
71-
}),
72-
alert:{
73-
marginBottom:theme.spacing(1),
74-
},
75-
header:{
68+
conststyles={
69+
header:(theme)=>({
7670
marginBottom:theme.spacing(3),
7771
display:"flex",
7872
flexDirection:"row",
7973
justifyContent:"space-between",
80-
},
81-
description:{
74+
}),
75+
description:(theme)=>({
8276
color:theme.palette.text.secondary,
8377
fontSize:16,
8478
marginTop:theme.spacing(0.5),
8579
lineHeight:"140%",
86-
},
87-
}));
80+
}),
81+
}satisfiesRecord<string,Interpolation<Theme>>;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp