Skip to content

Instantly share code, notes, and snippets.

@keremistan
Created March 18, 2021 08:51
Show Gist options
  • Save keremistan/8f9059f7a017c451ebdf964248ab766d to your computer and use it in GitHub Desktop.
Save keremistan/8f9059f7a017c451ebdf964248ab766d to your computer and use it in GitHub Desktop.
A absolute positioning sample where HTML is moved a level higher.
const useStyles = makeStyles({
correctSlidersWrapper: {
display: 'flex',
alignItems: 'center',
position: 'relative',
'&__rightButton': {
position: 'absolute',
right: '0',
},
'&__leftButton': {
position: 'absolute',
left: '0',
},
}
}, {name: 'MuiBlogPost'});
export function SliderButtonsBlogPost() {
const classes = useStyles();
return (
<section className={classes.buttonSamplesWrapper}>
<h1>Flexed Positions</h1>
<div className={`${classes.correctSlidersWrapper}`} >
<LeftSliderButton className={`${classes.correctSlidersWrapper}__leftButton`} />
<div className={`${classes.sampleWrapper}`}>
{get10RandomColors().map(color => <Color colorName={color} />)}
</div>
<RightSliderButton className={`${classes.correctSlidersWrapper}__rightButton`} />
</div>
</section>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment