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][base] Move styles to the bottom of demos code for SliderUnstyled #36721

Merged
merged 3 commits into from
Apr 28, 2023
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
58 changes: 29 additions & 29 deletions docs/data/base/components/slider/DiscreteSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,35 @@ import PropTypes from 'prop-types';
import { styled, alpha, Box } from '@mui/system';
import Slider, { sliderClasses } from '@mui/base/Slider';

export default function DiscreteSlider() {
Copy link
Member

Choose a reason for hiding this comment

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

Let's move this first after the import statements.

return (
<Box sx={{ width: 300 }}>
<StyledSlider
aria-label="Temperature"
defaultValue={30}
getAriaValueText={valuetext}
step={10}
marks
min={10}
max={110}
slots={{ valueLabel: SliderValueLabel }}
/>
</Box>
);
}

function SliderValueLabel({ children }) {
return <span className="valueLabel">{children}</span>;
}

SliderValueLabel.propTypes = {
children: PropTypes.element.isRequired,
};

function valuetext(value) {
return `${value}°C`;
}

const blue = {
100: '#DAECFF',
200: '#99CCF3',
Expand Down Expand Up @@ -122,32 +151,3 @@ const StyledSlider = styled(Slider)(
}
`,
);

function SliderValueLabel({ children }) {
return <span className="valueLabel">{children}</span>;
}

SliderValueLabel.propTypes = {
children: PropTypes.element.isRequired,
};

function valuetext(value) {
return `${value}°C`;
}

export default function DiscreteSlider() {
return (
<Box sx={{ width: 300 }}>
<StyledSlider
aria-label="Temperature"
defaultValue={30}
getAriaValueText={valuetext}
step={10}
marks
min={10}
max={110}
slots={{ valueLabel: SliderValueLabel }}
/>
</Box>
);
}
58 changes: 29 additions & 29 deletions docs/data/base/components/slider/DiscreteSlider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,35 @@ import * as React from 'react';
import { styled, alpha, Box } from '@mui/system';
import Slider, { sliderClasses } from '@mui/base/Slider';

export default function DiscreteSlider() {
Copy link
Member

Choose a reason for hiding this comment

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

Same here x the others.

return (
<Box sx={{ width: 300 }}>
<StyledSlider
aria-label="Temperature"
defaultValue={30}
getAriaValueText={valuetext}
step={10}
marks
min={10}
max={110}
slots={{ valueLabel: SliderValueLabel }}
/>
</Box>
);
}

interface SliderValueLabelProps {
children: React.ReactElement;
}

function SliderValueLabel({ children }: SliderValueLabelProps) {
return <span className="valueLabel">{children}</span>;
}

function valuetext(value: number) {
return `${value}°C`;
}

const blue = {
100: '#DAECFF',
200: '#99CCF3',
Expand Down Expand Up @@ -121,32 +150,3 @@ const StyledSlider = styled(Slider)(
}
`,
);

interface SliderValueLabelProps {
children: React.ReactElement;
}

function SliderValueLabel({ children }: SliderValueLabelProps) {
return <span className="valueLabel">{children}</span>;
}

function valuetext(value: number) {
return `${value}°C`;
}

export default function DiscreteSlider() {
return (
<Box sx={{ width: 300 }}>
<StyledSlider
aria-label="Temperature"
defaultValue={30}
getAriaValueText={valuetext}
step={10}
marks
min={10}
max={110}
slots={{ valueLabel: SliderValueLabel }}
/>
</Box>
);
}
72 changes: 36 additions & 36 deletions docs/data/base/components/slider/DiscreteSliderMarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,42 @@ import * as React from 'react';
import { styled, alpha, Box } from '@mui/system';
import Slider, { sliderClasses } from '@mui/base/Slider';

export default function DiscreteSliderMarks() {
return (
<Box sx={{ width: 300 }}>
<StyledSlider
aria-label="Temperature"
defaultValue={37}
getAriaValueText={valuetext}
marks={marks}
/>
</Box>
);
}

const marks = [
{
value: 0,
label: '0°C',
},
{
value: 20,
label: '20°C',
},
{
value: 37,
label: '37°C',
},
{
value: 100,
label: '100°C',
},
];

function valuetext(value) {
return `${value}°C`;
}

const blue = {
100: '#DAECFF',
200: '#99CCF3',
Expand Down Expand Up @@ -119,39 +155,3 @@ const StyledSlider = styled(Slider)(
}
`,
);

const marks = [
{
value: 0,
label: '0°C',
},
{
value: 20,
label: '20°C',
},
{
value: 37,
label: '37°C',
},
{
value: 100,
label: '100°C',
},
];

function valuetext(value) {
return `${value}°C`;
}

export default function DiscreteSliderMarks() {
return (
<Box sx={{ width: 300 }}>
<StyledSlider
aria-label="Temperature"
defaultValue={37}
getAriaValueText={valuetext}
marks={marks}
/>
</Box>
);
}
72 changes: 36 additions & 36 deletions docs/data/base/components/slider/DiscreteSliderMarks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,42 @@ import * as React from 'react';
import { styled, alpha, Box } from '@mui/system';
import Slider, { sliderClasses } from '@mui/base/Slider';

export default function DiscreteSliderMarks() {
return (
<Box sx={{ width: 300 }}>
<StyledSlider
aria-label="Temperature"
defaultValue={37}
getAriaValueText={valuetext}
marks={marks}
/>
</Box>
);
}

const marks = [
{
value: 0,
label: '0°C',
},
{
value: 20,
label: '20°C',
},
{
value: 37,
label: '37°C',
},
{
value: 100,
label: '100°C',
},
];

function valuetext(value: number) {
return `${value}°C`;
}

const blue = {
100: '#DAECFF',
200: '#99CCF3',
Expand Down Expand Up @@ -119,39 +155,3 @@ const StyledSlider = styled(Slider)(
}
`,
);

const marks = [
{
value: 0,
label: '0°C',
},
{
value: 20,
label: '20°C',
},
{
value: 37,
label: '37°C',
},
{
value: 100,
label: '100°C',
},
];

function valuetext(value: number) {
return `${value}°C`;
}

export default function DiscreteSliderMarks() {
return (
<Box sx={{ width: 300 }}>
<StyledSlider
aria-label="Temperature"
defaultValue={37}
getAriaValueText={valuetext}
marks={marks}
/>
</Box>
);
}
74 changes: 37 additions & 37 deletions docs/data/base/components/slider/DiscreteSliderValues.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,43 @@ import * as React from 'react';
import { styled, alpha, Box } from '@mui/system';
import Slider, { sliderClasses } from '@mui/base/Slider';

export default function DiscreteSliderValues() {
return (
<Box sx={{ width: 300 }}>
<StyledSlider
aria-label="Temperature"
defaultValue={37}
getAriaValueText={valuetext}
step={null}
marks={marks}
/>
</Box>
);
}

const marks = [
{
value: 0,
label: '0°C',
},
{
value: 20,
label: '20°C',
},
{
value: 37,
label: '37°C',
},
{
value: 100,
label: '100°C',
},
];

function valuetext(value) {
return `${value}°C`;
}

const blue = {
100: '#DAECFF',
200: '#99CCF3',
Expand Down Expand Up @@ -119,40 +156,3 @@ const StyledSlider = styled(Slider)(
}
`,
);

const marks = [
{
value: 0,
label: '0°C',
},
{
value: 20,
label: '20°C',
},
{
value: 37,
label: '37°C',
},
{
value: 100,
label: '100°C',
},
];

function valuetext(value) {
return `${value}°C`;
}

export default function DiscreteSliderValues() {
return (
<Box sx={{ width: 300 }}>
<StyledSlider
aria-label="Temperature"
defaultValue={37}
getAriaValueText={valuetext}
step={null}
marks={marks}
/>
</Box>
);
}
Loading