Skip to content

Commit 163d857

Browse files
committed
Use NoteBox component, and fix overflow detection
1 parent 9539df4 commit 163d857

2 files changed

Lines changed: 21 additions & 38 deletions

File tree

packages/libs/wdk-client/src/Views/Records/RecordTable/RecordTableDescription.jsx

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
import PropTypes from 'prop-types';
22
import React, { useState } from 'react';
33
import { safeHtml, wrappable } from '../../../Utils/ComponentUtils';
4-
5-
const containerStyle = {
6-
display: 'flex',
7-
flexWrap: 'wrap',
8-
borderLeft: '.2em solid #79a3d7',
9-
borderRight: '.2em solid #79a3d7',
10-
padding: '.5em 1em',
11-
background: '#ebf4ff',
12-
gap: '1em',
13-
marginBottom: '1em',
14-
};
4+
import { NoteBox } from '@veupathdb/coreui';
155

166
function RecordTableDescription(props) {
177
const { description } = props.table;
@@ -21,7 +11,7 @@ function RecordTableDescription(props) {
2111
if (!description) return null;
2212

2313
return (
24-
<div style={containerStyle}>
14+
<NoteBox type="info">
2515
{safeHtml(
2616
description,
2717
{
@@ -30,7 +20,7 @@ function RecordTableDescription(props) {
3020
return;
3121
}
3222
if (
33-
el.clientWidth >= el.scrollWidth ||
23+
el.clientWidth >= el.scrollWidth &&
3424
el.clientHeight >= el.scrollHeight
3525
) {
3626
setIsOverflowing(false);
@@ -51,15 +41,23 @@ function RecordTableDescription(props) {
5141
'div'
5242
)}
5343
{isOverflowing && (
54-
<button
55-
type="button"
56-
className="link"
57-
onClick={() => setIsExpanded((value) => !value)}
58-
>
59-
{isExpanded ? 'Read less' : 'Read more'}
60-
</button>
44+
<>
45+
<button
46+
type="button"
47+
style={{
48+
border: 'none',
49+
padding: 0,
50+
margin: '1ex 0 0 0',
51+
background: 'transparent',
52+
color: '#069',
53+
}}
54+
onClick={() => setIsExpanded((value) => !value)}
55+
>
56+
{isExpanded ? 'Read less' : 'Read more'}
57+
</button>
58+
</>
6159
)}
62-
</div>
60+
</NoteBox>
6361
);
6462
}
6563

packages/sites/ortho-site/webapp/wdkCustomization/js/client/records/Sequences.tsx

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { PfamDomain } from 'ortho-client/components/pfam-domains/PfamDomain';
3131
import {
3232
FilledButton,
3333
FloatingButton,
34+
NoteBox,
3435
OutlinedButton,
3536
SelectList,
3637
Undo,
@@ -662,23 +663,7 @@ export function RecordTable_Sequences(
662663
} as CSSProperties
663664
}
664665
>
665-
{warningText && (
666-
<div
667-
style={{
668-
display: 'flex',
669-
flexWrap: 'wrap',
670-
borderLeft: '.2em solid rgb(225, 133, 133)',
671-
borderRight: '.2em solid rgb(225, 133, 133)',
672-
padding: '.5em 1em',
673-
background: 'rgb(255, 228, 228)',
674-
gap: '1em',
675-
marginBottom: '1em',
676-
fontWeight: 500,
677-
}}
678-
>
679-
{warningText}
680-
</div>
681-
)}
666+
{warningText && <NoteBox type="error">{warningText}</NoteBox>}
682667
<div
683668
style={{
684669
padding: '10px',

0 commit comments

Comments
 (0)