Skip to content

Commit

Permalink
FormsTable is full-width for verbs & adjj that have comparatives
Browse files Browse the repository at this point in the history
  • Loading branch information
DuncanRitchie committed Mar 7, 2024
1 parent ff4d4d1 commit 553078a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
7 changes: 6 additions & 1 deletion components/lemma/FormsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ const FormsTable = ({
linkBase,
currentWordHyphenated,
openByDefault = true,
isFullWidth = false,
}) => {
const isDisplayedInTabs = !!(
Forms.unencliticized ||
Expand Down Expand Up @@ -208,7 +209,11 @@ const FormsTable = ({
/>
)

return <div className={styles.formsTable}>{formsTable}</div>
const classNames = isFullWidth
? styles.formsTable + ' ' + styles.fullWidth
: styles.formsTable

return <div className={classNames}>{formsTable}</div>
}

export default FormsTable
19 changes: 17 additions & 2 deletions components/lemma/FormsTable.module.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
.formsTable {
--forms-offset-left: 1.5rem;
--forms-offset-left: clamp(1rem, 5vw, 1.5rem);
--forms-table-margin-inline: 0rem;
width: calc(100% + 2 * var(--forms-table-margin-inline));
margin-left: calc(-1 * var(--forms-table-margin-inline));
}

.formsTable.fullWidth {
--forms-offset-left: calc(clamp(1rem, 5vw, 1.5rem) / 2);
--forms-table-margin-inline: calc(50vw - 1rem - var(--page-width) / 2);
}

.formsTable details {
text-align: left;
tab-size: 2;
margin-left: 1rem;
width: calc(100% - 2rem);
margin-inline: 1rem;
min-width: calc(100% - 2rem);
}

.formsTable summary {
width: max-content;
margin-left: var(--forms-table-margin-inline);
margin-right: auto;
margin-bottom: 0.5em;
padding: 0;
Expand Down Expand Up @@ -95,9 +104,15 @@
z-index: 1 /* must be in front of dashes */;
}

.formsTable.fullWidth dt {
font-size: 0.75em;
opacity: 0.5;
}

.formsTable dl div:hover > dt {
background-image: linear-gradient(to bottom right, #efe1ab, transparent);
border-color: #34311a;
opacity: 1;
}

.formsTable dd {
Expand Down
6 changes: 6 additions & 0 deletions components/lemma/Tabs.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
.tabs > ul {
margin-top: 0.25rem;
min-width: 100%;
min-width: calc(100% - 2 * var(--forms-table-margin-inline, 0));
margin-left: var(--forms-table-margin-inline, 0);
}

.tabs [role='tab'],
Expand Down Expand Up @@ -61,6 +63,10 @@
padding: 0.5rem;
border: 1px solid #58522c;
border-radius: 0 0.3333rem 0.3333rem;
/* The top-left corner is only rounded if --forms-table-margin-inline is more than what the rounding would be. */
border-top-left-radius: calc(
max(min(var(--forms-table-margin-inline, 0rem), 0.3333rem), 0rem)
);
background: #fffdf4;
overflow-x: auto;
scroll-margin-top: 5rem;
Expand Down

0 comments on commit 553078a

Please sign in to comment.