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

[docs] Improve font size scaling of some demos #19950

Merged
merged 2 commits into from
Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 5 additions & 3 deletions docs/src/pages/components/app-bar/PrimarySearchAppBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const useStyles = makeStyles(theme => ({
},
},
searchIcon: {
width: theme.spacing(7),
padding: theme.spacing(0, 2),
height: '100%',
position: 'absolute',
pointerEvents: 'none',
Expand All @@ -56,11 +56,13 @@ const useStyles = makeStyles(theme => ({
color: 'inherit',
},
inputInput: {
padding: theme.spacing(1, 1, 1, 7),
padding: theme.spacing(1, 1, 1, 0),
// vertical padding + font size from searchIcon
paddingLeft: `calc(1em + ${theme.spacing(4)}px)`,
transition: theme.transitions.create('width'),
width: '100%',
[theme.breakpoints.up('md')]: {
width: 200,
width: '20ch',
},
},
sectionDesktop: {
Expand Down
8 changes: 5 additions & 3 deletions docs/src/pages/components/app-bar/PrimarySearchAppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const useStyles = makeStyles((theme: Theme) =>
},
},
searchIcon: {
width: theme.spacing(7),
padding: theme.spacing(0, 2),
height: '100%',
position: 'absolute',
pointerEvents: 'none',
Expand All @@ -57,11 +57,13 @@ const useStyles = makeStyles((theme: Theme) =>
color: 'inherit',
},
inputInput: {
padding: theme.spacing(1, 1, 1, 7),
padding: theme.spacing(1, 1, 1, 0),
// vertical padding + font size from searchIcon
paddingLeft: `calc(1em + ${theme.spacing(4)}px)`,
transition: theme.transitions.create('width'),
width: '100%',
[theme.breakpoints.up('md')]: {
width: 200,
width: '20ch',
},
},
sectionDesktop: {
Expand Down
10 changes: 6 additions & 4 deletions docs/src/pages/components/app-bar/SearchAppBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const useStyles = makeStyles(theme => ({
},
},
searchIcon: {
width: theme.spacing(7),
padding: theme.spacing(0, 2),
height: '100%',
position: 'absolute',
pointerEvents: 'none',
Expand All @@ -49,13 +49,15 @@ const useStyles = makeStyles(theme => ({
color: 'inherit',
},
inputInput: {
padding: theme.spacing(1, 1, 1, 7),
padding: theme.spacing(1, 1, 1, 0),
// vertical padding + font size from searchIcon
paddingLeft: `calc(1em + ${theme.spacing(4)}px)`,
transition: theme.transitions.create('width'),
width: '100%',
[theme.breakpoints.up('sm')]: {
width: 120,
width: '12ch',
'&:focus': {
width: 200,
width: '20ch',
},
},
},
Expand Down
10 changes: 6 additions & 4 deletions docs/src/pages/components/app-bar/SearchAppBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const useStyles = makeStyles((theme: Theme) =>
},
},
searchIcon: {
width: theme.spacing(7),
padding: theme.spacing(0, 2),
height: '100%',
position: 'absolute',
pointerEvents: 'none',
Expand All @@ -50,13 +50,15 @@ const useStyles = makeStyles((theme: Theme) =>
color: 'inherit',
},
inputInput: {
padding: theme.spacing(1, 1, 1, 7),
padding: theme.spacing(1, 1, 1, 0),
// vertical padding + font size from searchIcon
paddingLeft: `calc(1em + ${theme.spacing(4)}px)`,
transition: theme.transitions.create('width'),
width: '100%',
[theme.breakpoints.up('sm')]: {
width: 120,
width: '12ch',
'&:focus': {
width: 200,
width: '20ch',
},
},
},
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/components/lists/AlignItemsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import Typography from '@material-ui/core/Typography';

const useStyles = makeStyles(theme => ({
root: {
width: '100%',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
inline: {
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/components/lists/AlignItemsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import Typography from '@material-ui/core/Typography';
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
width: '100%',
maxWidth: 360,
Copy link
Member

@oliviertassinari oliviertassinari Mar 3, 2020

Choose a reason for hiding this comment

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

The change breaks the purpose of the demo:

You should change the list item alignment when displaying 3 lines or more, set the alignItems="flex-start" property.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand the purpose from this sentence. How does the width relate to the number of items?

Copy link
Member

@oliviertassinari oliviertassinari Mar 3, 2020

Choose a reason for hiding this comment

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

The idea is to have list items with enough height to show the impact of the flex positioning of the avatar (top vs middle)

Copy link
Member Author

Choose a reason for hiding this comment

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

So why not set the height instead?

Copy link
Member

Choose a reason for hiding this comment

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

Relying on text wrapping avoids the need to know the computed line-height. In our case, I think that a width ch approach would work.

backgroundColor: theme.palette.background.paper,
},
inline: {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/menus/LongMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function LongMenu() {
PaperProps={{
style: {
maxHeight: ITEM_HEIGHT * 4.5,
width: 200,
width: '20ch',
},
}}
>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/menus/LongMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function LongMenu() {
PaperProps={{
style: {
maxHeight: ITEM_HEIGHT * 4.5,
width: 200,
width: '20ch',
},
}}
>
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/components/menus/SimpleListMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import Menu from '@material-ui/core/Menu';

const useStyles = makeStyles(theme => ({
root: {
width: '100%',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
}));
Expand Down
2 changes: 0 additions & 2 deletions docs/src/pages/components/menus/SimpleListMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import Menu from '@material-ui/core/Menu';
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
width: '100%',
maxWidth: 360,
backgroundColor: theme.palette.background.paper,
},
}),
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/BasicTextFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const useStyles = makeStyles(theme => ({
root: {
'& > *': {
margin: theme.spacing(1),
width: 200,
width: '25ch',
},
},
}));
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/BasicTextFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const useStyles = makeStyles((theme: Theme) =>
root: {
'& > *': {
margin: theme.spacing(1),
width: 200,
width: '25ch',
},
},
}),
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/ColorTextFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const useStyles = makeStyles(theme => ({
root: {
'& > *': {
margin: theme.spacing(1),
width: 200,
width: '25ch',
},
},
}));
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/ColorTextFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const useStyles = makeStyles((theme: Theme) =>
root: {
'& > *': {
margin: theme.spacing(1),
width: 200,
width: '25ch',
},
},
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const useStyles = makeStyles(theme => ({
root: {
'& .MuiTextField-root': {
margin: theme.spacing(1),
width: 200,
width: '25ch',
},
},
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const useStyles = makeStyles((theme: Theme) =>
root: {
'& .MuiTextField-root': {
margin: theme.spacing(1),
width: 200,
width: '25ch',
},
},
}),
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/InputAdornments.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const useStyles = makeStyles(theme => ({
marginTop: theme.spacing(3),
},
textField: {
width: 200,
width: '25ch',
},
}));

Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/InputAdornments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const useStyles = makeStyles((theme: Theme) =>
marginTop: theme.spacing(3),
},
textField: {
width: 200,
width: '25ch',
},
}),
);
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/LayoutTextFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const useStyles = makeStyles(theme => ({
textField: {
marginLeft: theme.spacing(1),
marginRight: theme.spacing(1),
width: 200,
width: '25ch',
},
}));

Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/LayoutTextFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const useStyles = makeStyles((theme: Theme) =>
textField: {
marginLeft: theme.spacing(1),
marginRight: theme.spacing(1),
width: 200,
width: '25ch',
},
}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const useStyles = makeStyles(theme => ({
root: {
'& .MuiTextField-root': {
margin: theme.spacing(1),
width: 200,
width: '25ch',
},
},
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const useStyles = makeStyles((theme: Theme) =>
root: {
'& .MuiTextField-root': {
margin: theme.spacing(1),
width: 200,
width: '25ch',
},
},
}),
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/SelectTextFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const useStyles = makeStyles(theme => ({
root: {
'& .MuiTextField-root': {
margin: theme.spacing(1),
width: 200,
width: '25ch',
},
},
}));
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/SelectTextFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const useStyles = makeStyles((theme: Theme) =>
root: {
'& .MuiTextField-root': {
margin: theme.spacing(1),
width: 200,
width: '25ch',
},
},
}),
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/StateTextFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const useStyles = makeStyles(theme => ({
root: {
'& .MuiTextField-root': {
margin: theme.spacing(1),
width: 200,
width: '25ch',
},
},
}));
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/components/text-fields/StateTextFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const useStyles = makeStyles((theme: Theme) =>
root: {
'& .MuiTextField-root': {
margin: theme.spacing(1),
width: 200,
width: '25ch',
},
},
}),
Expand Down