Skip to content

Commit

Permalink
feat: make columns have fixed width
Browse files Browse the repository at this point in the history
For #356.
  • Loading branch information
liammulh committed Feb 8, 2023
1 parent 1a3a657 commit e8746d1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/client/components/TranslationFormRow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import React, { useContext } from 'react';
import InputErrorMessage from './InputErrorMessage.jsx';
import { LocaleInfoContext } from './RosettaRoutes.jsx';
import boxArrowInRight from '../img/box-arrow-in-right.svg';
// eslint-disable-next-line bad-text
import '../styles/table.css';

/**
* This component is a row in the translation table. It has the string key, the English string, and an input for
Expand Down
10 changes: 8 additions & 2 deletions src/client/jsx/getSortedTranslationReportRows.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { Link } from 'react-router-dom';
import StatsInfoButton from '../components/StatsInfoButton.jsx';
import alertErrorMessage from '../js/alertErrorMessage.js';
import SortDirectionEnum from '../js/SortDirectionEnum.js';
// eslint-disable-next-line bad-text
import '../styles/table.css';

/**
* Return an array of translation report objects (i.e. stats used to make translation report rows) that have
Expand Down Expand Up @@ -143,6 +145,10 @@ const getSortedTranslationReportRows = (
sortKeys
);

const tdStyle = {
width: '30%'
};

// Create the array of JSX to render in the translation report.
const translationReportJsx = [];
for ( const item of sortedData ) {
Expand All @@ -154,8 +160,8 @@ const getSortedTranslationReportRows = (

translationReportJsx.push(
<tr key={item.simName}>
<td><Link to={`/translate/${locale}/${item.simName}`}>{item.simTitle}</Link>{pendingUpdateMessage}</td>
<td>
<td style={tdStyle}><Link to={`/translate/${locale}/${item.simName}`}>{item.simTitle}</Link>{pendingUpdateMessage}</td>
<td style={tdStyle}>
<StatsInfoButton reportObject={item}/>
{item.percentTotal}% ({item.totalTranslatedStrings} of {item.totalStrings})
</td>
Expand Down
2 changes: 2 additions & 0 deletions src/client/jsx/getTranslationReportRows.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import { Link } from 'react-router-dom';
import StatsInfoButton from '../components/StatsInfoButton.jsx';
import getSortedTranslationReportRows from './getSortedTranslationReportRows.jsx';
// eslint-disable-next-line bad-text
import '../styles/table.css';

/**
* Return an array of translation report table rows, i.e. return an array of JSX. These rows are put into the
Expand Down
10 changes: 10 additions & 0 deletions src/client/styles/table.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
:root {
--row-width: 450px;
}

td {
min-width: var(--row-width);
max-width: var(--row-width);
inline-size: var(--row-width);
overflow-wrap: break-word;
}

0 comments on commit e8746d1

Please sign in to comment.