Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed Sep 17, 2020
1 parent cc0c69d commit 3f5a1ee
Show file tree
Hide file tree
Showing 6 changed files with 328 additions and 240 deletions.
22 changes: 14 additions & 8 deletions src/components/manage/Blocks/DiscodataComponents/Text/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ function isColor(strColor) {
}

const components = {
h1: (text, color, tooltip = false, tooltipText = '') => (
bold: (bold, text) => {
if (bold) return <b>{text}</b>;
return text;
},
h1: (text, bold, color, tooltip = false, tooltipText = '') => (
<h1 className="query-param-text" style={{ color: color }}>
{text}
{components.bold(bold, text)}
{tooltip && tooltipText ? (
<span data-tip={tooltip && tooltipText ? tooltipText : false}>
<Icon name={infoSVG} size="20" color={color} />
Expand All @@ -25,19 +29,19 @@ const components = {
)}
</h1>
),
h2: (text, color) => (
h2: (text, bold, color) => (
<h2 className="query-param-text" style={{ color: color }}>
{text}
{components.bold(bold, text)}
</h2>
),
h3: (text, color) => (
h3: (text, bold, color) => (
<h3 className="query-param-text" style={{ color: color }}>
{text}
{components.bold(bold, text)}
</h3>
),
p: (text, color) => (
p: (text, bold, color) => (
<p className="query-param-text" style={{ color: color }}>
{text}
{components.bold(bold, text)}
</p>
),
link: (text, internalLink, linkTarget, link, color) => {
Expand Down Expand Up @@ -71,6 +75,7 @@ const View = ({ content, ...props }) => {
rightText = '',
color = '#000',
order = 'dq',
bold = false,
} = data;
const {
isLink = false,
Expand Down Expand Up @@ -211,6 +216,7 @@ const View = ({ content, ...props }) => {
{textMayRender && components[component]
? components[component](
isLink ? renderLinks[triggerOn] : text,
bold,
isColor(color) ? color : '#000',
tooltip,
tooltipText,
Expand Down
5 changes: 5 additions & 0 deletions src/components/manage/Blocks/DiscodataComponents/schema.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export const makeTextSchema = (props) => {
'rightText',
'color',
'component',
'bold',
],
},
{
Expand Down Expand Up @@ -225,6 +226,10 @@ export const makeTextSchema = (props) => {
['p', 'Paragraph'],
],
},
bold: {
title: 'Bold',
type: 'boolean',
},
isLink: {
title: 'Is link',
type: 'boolean',
Expand Down
146 changes: 71 additions & 75 deletions src/components/manage/Blocks/DiscodataComponentsBlock/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,7 @@ const renderComponents = {
.slice(0, maxElements);
}
const view = (
<ol
className={cx(
'link-list responsive grid grid-cl-4',
props.component?.className?.join(' '),
)}
>
<ol className={cx('link-list', props.component?.className?.join(' '))}>
{items.map((value) => (
<li key={_uniqueId('li-')}>
<button
Expand Down Expand Up @@ -484,7 +479,7 @@ const renderComponents = {
},
eprtrBatDerogations: (props) => {
const items = props.item[props.component.value] || [];
return (
return items.length ? (
<div className="eprtrBatDerogations">
<h2 className="mb-0-super mr-1">BAT Derogations</h2>
<Table className="unstackable">
Expand All @@ -497,25 +492,24 @@ const renderComponents = {
</Table.Header>

<Table.Body>
{items.length &&
items.map((item) => (
<Table.Row key={item.id}>
<Table.Cell>{item.BATAEL}</Table.Cell>
<Table.Cell>
{moment(item.derogationDurationStartDate).format(
'DD MMM YYYY',
)}
</Table.Cell>
<Table.Cell>
{moment(item.derogationDurationEndDate).format(
'DD MMM YYYY',
)}
</Table.Cell>
</Table.Row>
))}
{items.map((item) => (
<Table.Row key={item.id}>
<Table.Cell>{item.BATAEL}</Table.Cell>
<Table.Cell>
{moment(item.derogationDurationStartDate).format(
'DD MMM YYYY',
)}
</Table.Cell>
<Table.Cell>
{moment(item.derogationDurationEndDate).format('DD MMM YYYY')}
</Table.Cell>
</Table.Row>
))}
</Table.Body>
</Table>
</div>
) : (
''
);
},
eprtrBatConclusions: (props) => {
Expand All @@ -527,62 +521,64 @@ const renderComponents = {
{/* <Icon name={infoSVG} size="30" color="#EC776A" /> */}
</div>
<div className="eprtrBatConclusions bat-container">
{Object.entries(batConclusions).map(([key, conclusion]) => (
<div key={key} className="bat-conclusion">
<div className="bat-title mb-2">
<h3>
{key}
{/* <Icon name={blankSVG} size="20" color="#EC776A" /> */}
</h3>
</div>
<div className="bat-details grid grid-cl-2 mb-2">
<div>
<p className="bold">Status</p>
{/* <p className="info">{conclusion[0].conclusionStatus}</p> */}
{Object.entries(batConclusions)
.filter((key) => key)
.map(([key, conclusion]) => (
<div key={key} className="bat-conclusion">
<div className="bat-title mb-2">
<h3>
{key}
{/* <Icon name={blankSVG} size="20" color="#EC776A" /> */}
</h3>
</div>
{/* <div>
<p className="bold">Status Modified</p>
<p className="info">{conclusion[0].Status}</p>
</div> */}
</div>
{props.show.aels && (
<div className="bat-aels mb-2">
<p className="bat-aels-title">BAT AELs</p>
{conclusion.map((ael, index) =>
ael.BATAELName ? (
<div
className="bat-ael"
key={`${index} - ${ael.BATAELName}`}
>
<div className="bat-title mb-2">
<h3>
{ael.BATAELName}
{/* <Icon name={blankSVG} size="20" color="#EC776A" /> */}
</h3>
</div>
<div className="bat-details grid grid-cl-1 mb-2">
<div>
<p className="bold">Status</p>
<p className="info">{ael.BATAELStatus}</p>
</div>
<div>
<p className="bold">Accepted date</p>
<p className="info">{ael.BATAELAcceptedDate}</p>
<div className="bat-details grid grid-cl-2 mb-2">
<div>
<p className="bold">Status</p>
<p className="info">{conclusion[0].conclusionStatus}</p>
</div>
{/* <div>
<p className="bold">Status Modified</p>
<p className="info">{conclusion[0].Status}</p>
</div> */}
</div>
{props.show.aels && (
<div className="bat-aels mb-2">
<p className="bat-aels-title">BAT AELs</p>
{conclusion.map((ael, index) =>
ael.BATAELName ? (
<div
className="bat-ael"
key={`${index} - ${ael.BATAELName}`}
>
<div className="bat-title mb-2">
<h3>
{ael.BATAELName}
{/* <Icon name={blankSVG} size="20" color="#EC776A" /> */}
</h3>
</div>
<div>
<p className="bold">Description</p>
<p className="info">{ael.Description}</p>
<div className="bat-details grid grid-cl-1 mb-2">
<div>
<p className="bold">Status</p>
<p className="info">{ael.BATAELStatus}</p>
</div>
<div>
<p className="bold">Accepted date</p>
<p className="info">{ael.BATAELAcceptedDate}</p>
</div>
<div>
<p className="bold">Description</p>
<p className="info">{ael.Description}</p>
</div>
</div>
</div>
</div>
) : (
<p>No information available</p>
),
)}
</div>
)}
</div>
))}
) : (
<p>No information available</p>
),
)}
</div>
)}
</div>
))}
<div className="hr mb-1" />
<div className="bat-action text-align-center">
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,10 @@ a.small h1 {
color: #EC776A;
padding: 0;
list-style: none;
display: flex;
flex-flow: row;
flex-wrap: wrap;
grid-gap: 20px;
}

.link-list li {
Expand Down
Loading

0 comments on commit 3f5a1ee

Please sign in to comment.