Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Players and Transcodings view mobile-friendly
- Loading branch information
Showing
2 changed files
with
50 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,28 @@ | ||
import React from 'react' | ||
import { Datagrid, List, TextField } from 'react-admin' | ||
import { Title } from '../common' | ||
import { useMediaQuery } from '@material-ui/core' | ||
import { SimpleList, Title } from '../common' | ||
|
||
const TranscodingList = (props) => ( | ||
<List title={<Title subTitle={'Transcodings'} />} exporter={false} {...props}> | ||
<Datagrid rowClick="edit"> | ||
<TextField source="name" /> | ||
<TextField source="targetFormat" /> | ||
<TextField source="defaultBitRate" /> | ||
<TextField source="command" /> | ||
</Datagrid> | ||
</List> | ||
) | ||
const TranscodingList = (props) => { | ||
const isXsmall = useMediaQuery((theme) => theme.breakpoints.down('xs')) | ||
return ( | ||
<List title={<Title subTitle={'Transcodings'} />} exporter={false} {...props}> | ||
{isXsmall ? ( | ||
<SimpleList | ||
primaryText={(r) => r.name} | ||
secondaryText={(r) => `format: ${r.targetFormat}`} | ||
tertiaryText={(r) => r.defaultBitRate} | ||
/> | ||
) : ( | ||
<Datagrid rowClick="edit"> | ||
<TextField source="name" /> | ||
<TextField source="targetFormat" /> | ||
<TextField source="defaultBitRate" /> | ||
<TextField source="command" /> | ||
</Datagrid> | ||
)} | ||
</List> | ||
) | ||
} | ||
|
||
export default TranscodingList |