add WordWrap and wrap question content in this component

This commit is contained in:
Dawid Wysokiński 2021-04-17 14:34:09 +02:00
parent 5f22bee3a6
commit 80e2765531
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,25 @@
import { makeStyles } from '@material-ui/core/styles';
interface Props {
children?: React.ReactNode;
}
const WordWrap = ({ children }: Props) => {
const classes = useStyles();
return <span className={classes.wordWrap}>{children}</span>;
};
const useStyles = makeStyles(() => ({
wordWrap: {
overflowWrap: 'break-word',
wordWrap: 'break-word',
'-ms-word-break': 'break-all',
wordBreak: 'break-word',
'-ms-hyphens': 'auto',
'-moz-hyphens': 'auto',
'-webkit-hyphens': 'auto',
hyphens: 'auto',
},
}));
export default WordWrap;

View File

@ -1,6 +1,7 @@
import { decodeSort } from 'libs/serialize-query-params/SortParam';
import { Column } from 'common/Table/types';
import { Question } from 'libs/graphql/types';
import WordWrap from './components/WordWrap/WordWrap';
export const DEFAULT_SORT = decodeSort('id DESC');
export const COLUMNS: Column<Question>[] = [
@ -18,6 +19,9 @@ export const COLUMNS: Column<Question>[] = [
field: 'content',
sortable: true,
label: 'Treść',
valueFormatter: v => {
return <WordWrap>{v.content}</WordWrap>;
},
},
{
field: 'qualification',