From a2815f6643178ac5c65e2c6a3cd24f99b1203e6c Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Sat, 28 Sep 2019 14:23:03 +0200 Subject: [PATCH] Fix model table display [ci skip] --- website/src/components/table.js | 8 +++++++- website/src/styles/code.module.sass | 1 + website/src/styles/table.module.sass | 3 +++ website/src/templates/models.js | 15 +++++++++------ 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/website/src/components/table.js b/website/src/components/table.js index 78646f4c3..85b8e2144 100644 --- a/website/src/components/table.js +++ b/website/src/components/table.js @@ -42,7 +42,13 @@ function isFootRow(children) { return false } -export const Table = props => +export const Table = ({ fixed, className, ...props }) => { + const tableClassNames = classNames(classes.root, className, { + [classes.fixed]: fixed, + }) + return
+} + export const Th = props =>
export const Tr = ({ evenodd = true, children, ...props }) => { diff --git a/website/src/styles/code.module.sass b/website/src/styles/code.module.sass index f72f1ffe6..b268904f5 100644 --- a/website/src/styles/code.module.sass +++ b/website/src/styles/code.module.sass @@ -56,6 +56,7 @@ .wrap white-space: pre-wrap + word-wrap: break-word .title, .juniper-button diff --git a/website/src/styles/table.module.sass b/website/src/styles/table.module.sass index 3e73ffb7f..68cc4bace 100644 --- a/website/src/styles/table.module.sass +++ b/website/src/styles/table.module.sass @@ -6,6 +6,9 @@ margin-bottom: var(--spacing-md) max-width: 100% +.fixed + table-layout: fixed + .tr thead &:nth-child(odd) background: transparent diff --git a/website/src/templates/models.js b/website/src/templates/models.js index 8a27599c5..dbfab6877 100644 --- a/website/src/templates/models.js +++ b/website/src/templates/models.js @@ -22,6 +22,7 @@ const MODEL_META = { core_sm: 'Vocabulary, syntax, entities', dep: 'Vocabulary, syntax', ent: 'Named entities', + pytt: 'PyTorch Transformers', vectors: 'Word vectors', web: 'written text (blogs, news, comments)', news: 'written text (news, media)', @@ -113,7 +114,7 @@ function formatSources(data = []) { const sources = data.map(s => (isString(s) ? { name: s } : s)) return sources.map(({ name, url, author }, i) => ( <> - {i > 0 && ', '} + {i > 0 &&
} {name && url ? {name} : name} {author && ` (${author})`} @@ -242,7 +243,7 @@ const Model = ({ name, langId, langName, baseUrl, repo, compatibility, hasExampl {accuracy && accuracy.map(({ label, items }, i) => !items ? null : ( - +
@@ -281,7 +282,7 @@ const Model = ({ name, langId, langName, baseUrl, repo, compatibility, hasExampl )} {labels && ( - +

The statistical components included in this model package assign the following labels. The labels are specific to the corpus that the model was @@ -291,13 +292,13 @@ const Model = ({ name, langId, langName, baseUrl, repo, compatibility, hasExampl .

-
{label}
+
{Object.keys(labels).map(pipe => { const labelNames = labels[pipe] || [] const help = LABEL_SCHEME_META[pipe] return ( -
+ @@ -306,7 +307,9 @@ const Model = ({ name, langId, langName, baseUrl, repo, compatibility, hasExampl {labelNames.map((label, i) => ( <> {i > 0 && ', '} - {label} + + {label} + ))}