Skip to content

Commit

Permalink
Merge branch 'master' into form-control-label-required
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeeshanTamboli committed Apr 12, 2023
2 parents 897b142 + 1a4263a commit 266d09f
Show file tree
Hide file tree
Showing 217 changed files with 8,286 additions and 5,423 deletions.
39 changes: 19 additions & 20 deletions docs/data/base/components/badge/AccessibleBadges.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ import { styled } from '@mui/system';
import BadgeUnstyled, { badgeUnstyledClasses } from '@mui/base/BadgeUnstyled';
import MailIcon from '@mui/icons-material/Mail';

function notificationsLabel(count) {
if (count === 0) {
return 'no notifications';
}
if (count > 99) {
return 'more than 99 notifications';
}
return `${count} notifications`;
}

export default function AccessibleBadges() {
return (
<div aria-label={notificationsLabel(100)}>
<StyledBadge badgeContent={100}>
<MailIcon />
</StyledBadge>
</div>
);
}
const blue = {
500: '#007FFF',
};
Expand Down Expand Up @@ -46,23 +65,3 @@ const StyledBadge = styled(BadgeUnstyled)(
}
`,
);

function notificationsLabel(count) {
if (count === 0) {
return 'no notifications';
}
if (count > 99) {
return 'more than 99 notifications';
}
return `${count} notifications`;
}

export default function AccessibleBadges() {
return (
<div aria-label={notificationsLabel(100)}>
<StyledBadge badgeContent={100}>
<MailIcon />
</StyledBadge>
</div>
);
}
39 changes: 19 additions & 20 deletions docs/data/base/components/badge/AccessibleBadges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@ import { styled } from '@mui/system';
import BadgeUnstyled, { badgeUnstyledClasses } from '@mui/base/BadgeUnstyled';
import MailIcon from '@mui/icons-material/Mail';

function notificationsLabel(count: number) {
if (count === 0) {
return 'no notifications';
}
if (count > 99) {
return 'more than 99 notifications';
}
return `${count} notifications`;
}

export default function AccessibleBadges() {
return (
<div aria-label={notificationsLabel(100)}>
<StyledBadge badgeContent={100}>
<MailIcon />
</StyledBadge>
</div>
);
}
const blue = {
500: '#007FFF',
};
Expand Down Expand Up @@ -46,23 +65,3 @@ const StyledBadge = styled(BadgeUnstyled)(
}
`,
);

function notificationsLabel(count: number) {
if (count === 0) {
return 'no notifications';
}
if (count > 99) {
return 'more than 99 notifications';
}
return `${count} notifications`;
}

export default function AccessibleBadges() {
return (
<div aria-label={notificationsLabel(100)}>
<StyledBadge badgeContent={100}>
<MailIcon />
</StyledBadge>
</div>
);
}
31 changes: 15 additions & 16 deletions docs/data/base/components/badge/BadgeMax.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ import { styled } from '@mui/system';
import BadgeUnstyled, { badgeUnstyledClasses } from '@mui/base/BadgeUnstyled';
import MailIcon from '@mui/icons-material/Mail';

export default function BadgeMax() {
return (
<Stack spacing={4} direction="row">
<StyledBadge badgeContent={99}>
<MailIcon />
</StyledBadge>
<StyledBadge badgeContent={100}>
<MailIcon />
</StyledBadge>
<StyledBadge badgeContent={1000} max={999}>
<MailIcon />
</StyledBadge>
</Stack>
);
}
const blue = {
500: '#007FFF',
};
Expand Down Expand Up @@ -47,19 +62,3 @@ const StyledBadge = styled(BadgeUnstyled)(
}
`,
);

export default function BadgeMax() {
return (
<Stack spacing={4} direction="row">
<StyledBadge badgeContent={99}>
<MailIcon />
</StyledBadge>
<StyledBadge badgeContent={100}>
<MailIcon />
</StyledBadge>
<StyledBadge badgeContent={1000} max={999}>
<MailIcon />
</StyledBadge>
</Stack>
);
}
31 changes: 15 additions & 16 deletions docs/data/base/components/badge/BadgeMax.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ import { styled } from '@mui/system';
import BadgeUnstyled, { badgeUnstyledClasses } from '@mui/base/BadgeUnstyled';
import MailIcon from '@mui/icons-material/Mail';

export default function BadgeMax() {
return (
<Stack spacing={4} direction="row">
<StyledBadge badgeContent={99}>
<MailIcon />
</StyledBadge>
<StyledBadge badgeContent={100}>
<MailIcon />
</StyledBadge>
<StyledBadge badgeContent={1000} max={999}>
<MailIcon />
</StyledBadge>
</Stack>
);
}
const blue = {
500: '#007FFF',
};
Expand Down Expand Up @@ -47,19 +62,3 @@ const StyledBadge = styled(BadgeUnstyled)(
}
`,
);

export default function BadgeMax() {
return (
<Stack spacing={4} direction="row">
<StyledBadge badgeContent={99}>
<MailIcon />
</StyledBadge>
<StyledBadge badgeContent={100}>
<MailIcon />
</StyledBadge>
<StyledBadge badgeContent={1000} max={999}>
<MailIcon />
</StyledBadge>
</Stack>
);
}
97 changes: 48 additions & 49 deletions docs/data/base/components/badge/BadgeVisibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,6 @@ import MailIcon from '@mui/icons-material/Mail';
import Switch from '@mui/material/Switch';
import FormControlLabel from '@mui/material/FormControlLabel';

const blue = {
500: '#007FFF',
};

const grey = {
300: '#afb8c1',
900: '#24292f',
};

const StyledBadge = styled(BadgeUnstyled)(
({ theme }) => `
box-sizing: border-box;
margin: 0;
padding: 0;
font-size: 14px;
list-style: none;
font-family: IBM Plex Sans, sans-serif;
position: relative;
display: inline-block;
line-height: 1;
& .${badgeUnstyledClasses.badge} {
z-index: auto;
position: absolute;
top: 0;
right: 0;
min-width: 22px;
height: 22px;
padding: 0 6px;
color: #fff;
font-weight: 600;
font-size: 12px;
line-height: 22px;
white-space: nowrap;
text-align: center;
border-radius: 12px;
background: ${blue[500]};
box-shadow: 0px 4px 6x ${theme.palette.mode === 'dark' ? grey[900] : grey[300]};
transform: translate(50%, -50%);
transform-origin: 100% 0;
}
& .${badgeUnstyledClasses.invisible} {
opacity: 0;
pointer-events: none;
}
`,
);

export default function BadgeVisibility() {
const [count, setCount] = React.useState(1);
const [invisible, setInvisible] = React.useState(false);
Expand Down Expand Up @@ -117,3 +68,51 @@ export default function BadgeVisibility() {
</Box>
);
}
const blue = {
500: '#007FFF',
};

const grey = {
300: '#afb8c1',
900: '#24292f',
};

const StyledBadge = styled(BadgeUnstyled)(
({ theme }) => `
box-sizing: border-box;
margin: 0;
padding: 0;
font-size: 14px;
list-style: none;
font-family: IBM Plex Sans, sans-serif;
position: relative;
display: inline-block;
line-height: 1;
& .${badgeUnstyledClasses.badge} {
z-index: auto;
position: absolute;
top: 0;
right: 0;
min-width: 22px;
height: 22px;
padding: 0 6px;
color: #fff;
font-weight: 600;
font-size: 12px;
line-height: 22px;
white-space: nowrap;
text-align: center;
border-radius: 12px;
background: ${blue[500]};
box-shadow: 0px 4px 6x ${theme.palette.mode === 'dark' ? grey[900] : grey[300]};
transform: translate(50%, -50%);
transform-origin: 100% 0;
}
& .${badgeUnstyledClasses.invisible} {
opacity: 0;
pointer-events: none;
}
`,
);
97 changes: 48 additions & 49 deletions docs/data/base/components/badge/BadgeVisibility.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,55 +10,6 @@ import MailIcon from '@mui/icons-material/Mail';
import Switch from '@mui/material/Switch';
import FormControlLabel from '@mui/material/FormControlLabel';

const blue = {
500: '#007FFF',
};

const grey = {
300: '#afb8c1',
900: '#24292f',
};

const StyledBadge = styled(BadgeUnstyled)(
({ theme }) => `
box-sizing: border-box;
margin: 0;
padding: 0;
font-size: 14px;
list-style: none;
font-family: IBM Plex Sans, sans-serif;
position: relative;
display: inline-block;
line-height: 1;
& .${badgeUnstyledClasses.badge} {
z-index: auto;
position: absolute;
top: 0;
right: 0;
min-width: 22px;
height: 22px;
padding: 0 6px;
color: #fff;
font-weight: 600;
font-size: 12px;
line-height: 22px;
white-space: nowrap;
text-align: center;
border-radius: 12px;
background: ${blue[500]};
box-shadow: 0px 4px 6x ${theme.palette.mode === 'dark' ? grey[900] : grey[300]};
transform: translate(50%, -50%);
transform-origin: 100% 0;
}
& .${badgeUnstyledClasses.invisible} {
opacity: 0;
pointer-events: none;
}
`,
);

export default function BadgeVisibility() {
const [count, setCount] = React.useState(1);
const [invisible, setInvisible] = React.useState(false);
Expand Down Expand Up @@ -117,3 +68,51 @@ export default function BadgeVisibility() {
</Box>
);
}
const blue = {
500: '#007FFF',
};

const grey = {
300: '#afb8c1',
900: '#24292f',
};

const StyledBadge = styled(BadgeUnstyled)(
({ theme }) => `
box-sizing: border-box;
margin: 0;
padding: 0;
font-size: 14px;
list-style: none;
font-family: IBM Plex Sans, sans-serif;
position: relative;
display: inline-block;
line-height: 1;
& .${badgeUnstyledClasses.badge} {
z-index: auto;
position: absolute;
top: 0;
right: 0;
min-width: 22px;
height: 22px;
padding: 0 6px;
color: #fff;
font-weight: 600;
font-size: 12px;
line-height: 22px;
white-space: nowrap;
text-align: center;
border-radius: 12px;
background: ${blue[500]};
box-shadow: 0px 4px 6x ${theme.palette.mode === 'dark' ? grey[900] : grey[300]};
transform: translate(50%, -50%);
transform-origin: 100% 0;
}
& .${badgeUnstyledClasses.invisible} {
opacity: 0;
pointer-events: none;
}
`,
);
Loading

0 comments on commit 266d09f

Please sign in to comment.