change ModeSelector styles

This commit is contained in:
Dawid Wysokiński 2020-12-27 18:02:59 +01:00
parent 3e89fcc749
commit b1121478ae
6 changed files with 15 additions and 12 deletions

View File

@ -1,7 +1,7 @@
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { Button, ButtonProps } from '@material-ui/core';
import { Button, ButtonProps, Toolbar } from '@material-ui/core';
export type Mode = {
name: string;
@ -20,11 +20,13 @@ function ModeSelector({ modes, onSelect, buttonProps = {}, style }: Props) {
const classes = useStyles();
return (
<div className={classes.container} style={style}>
<Toolbar className={classes.container} style={style}>
{modes.map(m => {
return (
<div key={m.name}>
<Button
size="small"
fullWidth
{...buttonProps}
variant={m.selected ? 'contained' : 'outlined'}
onClick={() => {
@ -32,21 +34,21 @@ function ModeSelector({ modes, onSelect, buttonProps = {}, style }: Props) {
onSelect(m);
}
}}
size="small"
fullWidth
>
{m.label ?? m.name}
</Button>
</div>
);
})}
</div>
</Toolbar>
);
}
const useStyles = makeStyles(theme => ({
container: {
padding: theme.spacing(1, 0),
paddingTop: theme.spacing(1),
paddingBottom: theme.spacing(1),
minHeight: 'auto',
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
@ -58,6 +60,8 @@ const useStyles = makeStyles(theme => ({
[theme.breakpoints.down('xs')]: {
flexDirection: 'column',
'& > *': {
paddingLeft: 0,
paddingRight: 0,
width: '100%',
},
},

View File

@ -61,9 +61,7 @@ function SearchPage() {
<Container>
<Paper>
<ModeSelector
buttonProps={{
variant: 'outlined',
}}
buttonProps={{ size: 'medium' }}
onSelect={m => setQuery({ mode: m.name, page: 0, limit: LIMIT })}
modes={[
{

View File

@ -27,6 +27,7 @@ function EnnoblementsPage() {
<Paper>
<ModeSelector
onSelect={m => setQuery({ mode: m.name })}
buttonProps={{ size: 'medium' }}
modes={[
{
name: 'live',

View File

@ -110,6 +110,8 @@ const useStyles = makeStyles(theme => ({
'& > *': {
margin: theme.spacing(0.5),
[theme.breakpoints.down('xs')]: {
marginLeft: 0,
marginRight: 0,
width: '100%',
},
},

View File

@ -56,9 +56,6 @@ function TodaysBestStatsPlayers({ server, t }: Props) {
</Typography>
</TableToolbar>
<ModeSelector
buttonProps={{
variant: 'outlined',
}}
onSelect={m => setMode(m.name as Mode)}
modes={[
{

View File

@ -122,6 +122,7 @@ function Members({ t, server, tribeID }: Props) {
<Paper>
<ModeSelector
onSelect={m => setMode(m.name as Mode)}
buttonProps={{ size: 'medium' }}
modes={[
{
name: 'points',