Skip to content

Commit 275c414

Browse files
Updated the styles to align the coverage and details next to each other
1 parent 47a20ad commit 275c414

File tree

5 files changed

+173
-39
lines changed

5 files changed

+173
-39
lines changed

src/components/Collapsible/CircularProgress.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
export const CircularProgress = ({ percentage = 65, size = 120, strokeWidth = 12 }) => {
3+
export const CircularProgress = ({ percentage = 65, size = 150, strokeWidth = 13 }) => {
44
const radius = (size - strokeWidth) / 2;
55
const circumference = 2 * Math.PI * radius;
66
const progress = circumference * (1 - percentage / 100);
@@ -37,7 +37,7 @@ export const CircularProgress = ({ percentage = 65, size = 120, strokeWidth = 12
3737
y="50%"
3838
dominantBaseline="central"
3939
textAnchor="middle"
40-
fontSize="24"
40+
fontSize="30"
4141
fontWeight="bold"
4242
fill="#4caf50"
4343
>
@@ -48,7 +48,7 @@ export const CircularProgress = ({ percentage = 65, size = 120, strokeWidth = 12
4848
y="70%"
4949
dominantBaseline="central"
5050
textAnchor="middle"
51-
fontSize="12"
51+
fontSize="18"
5252
fill="white"
5353
>
5454
Coverage

src/components/Collapsible/CollapsibleSection.jsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,21 +103,26 @@ const CollapsibleSection = ({ isPanelOpen, techniqueName, importContent, viewCus
103103
</div>
104104

105105
{isOpen && (
106-
<div className={`collapsible-details ${isPanelOpen ? 'shrink' : ''}`}>
107-
{type === 'details' ? (
108-
<>
106+
<div className={`collapsible-details ${isPanelOpen ? 'shrink' : ''}`} style={{ display: 'flex', width: '100%', flexWrap: 'nowrap' }}>
107+
{type === 'details' ? (
108+
<>
109+
{/* First section for Display Details (takes 70% of width) */}
110+
<div className="details-section1">
111+
{display_details(details, section_header)}
112+
</div>
113+
114+
{/* Second section for CircularProgress (takes 30% of width) */}
115+
<div className="circular-progress-section">
109116
{viewCustomMode && (section_header === 'Mitigation' || section_header === 'Detection') && (
110-
<div style={{ marginLeft: '40px' }}>
111-
<CircularProgress percentage={getCoverage(techniqueName, section_header)}/>
112-
</div>
117+
<CircularProgress percentage={getCoverage(techniqueName, section_header)} />
113118
)}
114-
115-
{display_details(details, section_header)}
116-
</>
117-
) : (
118-
display_references(references)
119-
)}
120-
</div>
119+
</div>
120+
</>
121+
) : (
122+
display_references(references)
123+
)}
124+
</div>
125+
121126
)}
122127

123128
</div>

src/components/ContentManager/ManageContent.css

Lines changed: 101 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
.collapsible-section {
1+
.collapsible-section1 {
22
margin: var(--gap) 0;
33
}
44

5-
.collapsible-content {
5+
.collapsible-content1 {
66
background-color: #2b2d31;
77
border: 1px solid #ddd;
88
color: white;
99
margin-left: 0;
10-
max-width: 100%;
10+
width: 100%;
1111
overflow: hidden;
1212
display: flex;
1313
flex-direction: column;
@@ -102,4 +102,101 @@
102102
cursor: pointer;
103103
margin-bottom: 10px !important;
104104
}
105-
105+
106+
107+
.Collapsible__trigger1 {
108+
position: relative;
109+
display: flex;
110+
align-items: center;
111+
justify-content: space-between;
112+
box-sizing: border-box;
113+
114+
padding: calc(var(--gap) / 3) var(--gap);
115+
116+
cursor: pointer;
117+
color: white;
118+
background-color: #0099cc;
119+
border-radius: 4px 4px 0 0;
120+
}
121+
122+
/* collapsible trigger heading, sub-heading */
123+
h3, h4 {
124+
margin: 0;
125+
font-size: inherit;
126+
font-weight: normal;
127+
}
128+
129+
.Collapsible__trigger1:not(.open) {
130+
border-radius: 4px;
131+
}
132+
133+
.Collapsible__trigger1.shrink {
134+
width: 80%; /* Shrink the details to 80% when RightPanel is open */
135+
}
136+
137+
.Collapsible__trigger1 .collapse-text {
138+
display: inline-block;
139+
overflow: hidden;
140+
white-space: nowrap;
141+
}
142+
143+
.Collapsible__trigger1 .collapse-icon {
144+
/* just a little tweak to get it to optically align with the technique name's
145+
close icon */
146+
margin-right: 4px;
147+
}
148+
149+
.collapsible-details1 {
150+
--collapsible-details1-rhythm: calc(var(--gap) / 4);
151+
152+
display: flex;
153+
flex-direction: column;
154+
justify-content: flex-start;
155+
156+
box-sizing: border-box;
157+
max-width: 100%;
158+
overflow: hidden;
159+
padding: calc(var(--gap) * 0.8) var(--gap);
160+
margin-left: 0;
161+
margin-bottom: var(--v-rhythm);
162+
border: 1px solid #ddd;
163+
border-top: none;
164+
165+
line-height: 1.3;
166+
background-color: #2b2d31;
167+
color: white;
168+
}
169+
170+
/* when the side drawer is open */
171+
.collapsible-details1.shrink {
172+
width: 80%;
173+
}
174+
175+
/* collapsible details ubheadings */
176+
h4 {
177+
font-weight: bold;
178+
}
179+
.collapsible-details1 > div:not(:first-of-type) h4 {
180+
margin-top: var(--gap);
181+
margin-bottom: var(--collapsible-details1-rhythm);
182+
}
183+
184+
.collapsible-details1 > div h4 {
185+
margin-bottom: var(--collapsible-details1-rhythm);
186+
}
187+
188+
/* most list content is formatted like paragraphs, with a little indent */
189+
.collapsible-details1-list > li {
190+
list-style-type: disc;
191+
margin-left: var(--gap);
192+
border-bottom: none;
193+
}
194+
.collapsible-details1-list > li:not(:last-of-type) {
195+
margin-bottom: calc(var(--gap) / 4);
196+
}
197+
198+
/* references list is numbered */
199+
.collapsible-details1-references > li {
200+
list-style-type: decimal;
201+
border-bottom: none;
202+
}

src/components/ContentManager/ManageContent.jsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ const ManageContent = (props) => {
400400
return (
401401
<div>
402402
{/* Collapsible Technique Section */}
403-
<section className="collapsible-section">
403+
<section className="collapsible-section1">
404404
<div>
405405
{showFailAlert && (
406406
<Alert
@@ -428,7 +428,7 @@ const ManageContent = (props) => {
428428
</div>
429429
)}
430430
<div
431-
className={`Collapsible__trigger ${openSections.technique ? 'open' : ''}`}
431+
className={`Collapsible__trigger1 ${openSections.technique ? 'open' : ''}`}
432432
onClick={() => handleToggle('technique')}
433433
>
434434
<h4>Technique Description</h4>
@@ -440,7 +440,7 @@ const ManageContent = (props) => {
440440
</div>
441441

442442
{openSections.technique && (
443-
<div className="collapsible-details">
443+
<div className="collapsible-details1">
444444
<form>
445445
<div>
446446
<label htmlFor="name" style={{ color: 'white', marginRight: '5px' }}>
@@ -470,7 +470,7 @@ const ManageContent = (props) => {
470470
>
471471
<h4 style={{ color: 'white' }}>Description</h4>
472472
{fields.description.map((field, index) => (
473-
<div key={index} style={{ display: 'flex', alignItems: 'center', marginBottom: '10px' }}>
473+
<div key={index} style={{ display: 'flex', alignItems: 'center', marginBottom: '10px', width: '100%' }}>
474474
<textarea
475475
value={field.value}
476476
onChange={(e) => handleFieldChange('description', index, e)}
@@ -561,10 +561,10 @@ const ManageContent = (props) => {
561561
</section>
562562

563563
{/* Collapsible Mitigation Section */}
564-
<section className="collapsible-section">
564+
<section className="collapsible-section1">
565565
<div>
566566
<div
567-
className={`Collapsible__trigger ${openSections.mitigation ? 'open' : ''}`}
567+
className={`Collapsible__trigger1 ${openSections.mitigation ? 'open' : ''}`}
568568
onClick={() => handleToggle('mitigation')}
569569
>
570570
<h4>Mitigation</h4>
@@ -576,18 +576,18 @@ const ManageContent = (props) => {
576576
</div>
577577

578578
{openSections.mitigation && (
579-
<div className="collapsible-details">
579+
<div className="collapsible-details1">
580580
<form>{addKeyValue('mitigation')}</form>
581581
</div>
582582
)}
583583
</div>
584584
</section>
585585

586586
{/* Collapsible Detection Section */}
587-
<section className="collapsible-section">
587+
<section className="collapsible-section1">
588588
<div>
589589
<div
590-
className={`Collapsible__trigger ${openSections.detection ? 'open' : ''}`}
590+
className={`Collapsible__trigger1 ${openSections.detection ? 'open' : ''}`}
591591
onClick={() => handleToggle('detection')}
592592
>
593593
<h4>Detection</h4>
@@ -599,18 +599,18 @@ const ManageContent = (props) => {
599599
</div>
600600

601601
{openSections.detection && (
602-
<div className="collapsible-details">
602+
<div className="collapsible-details1">
603603
<form>{addKeyValue('detection')}</form>
604604
</div>
605605
)}
606606
</div>
607607
</section>
608608

609609
{/* Collapsible References Section */}
610-
<section className="collapsible-section">
610+
<section className="collapsible-section1">
611611
<div>
612612
<div
613-
className={`Collapsible__trigger ${openSections.references ? 'open' : ''}`}
613+
className={`Collapsible__trigger1 ${openSections.references ? 'open' : ''}`}
614614
onClick={() => handleToggle('references')}
615615
>
616616
<h4>References</h4>
@@ -622,7 +622,7 @@ const ManageContent = (props) => {
622622
</div>
623623

624624
{openSections.references && (
625-
<div className="collapsible-details">
625+
<div className="collapsible-details1">
626626
<form>{addKeyValue('references')}</form>
627627
</div>
628628
)}

src/components/TableContent/more_details.css

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,14 @@ h3, h4 {
3535
}
3636

3737
.Collapsible__trigger .collapse-icon {
38-
/* just a little tweak to get it to optically align with the technique name's
39-
close icon */
4038
margin-right: 4px;
4139
}
4240

4341
.collapsible-details {
4442
--collapsible-details-rhythm: calc(var(--gap) / 4);
4543

4644
display: flex;
47-
flex-direction: column;
45+
flex-direction: row;
4846
justify-content: flex-start;
4947

5048
box-sizing: border-box;
@@ -66,7 +64,7 @@ h3, h4 {
6664
width: 80%;
6765
}
6866

69-
/* collapsible details ubheadings */
67+
/* collapsible details headings */
7068
h4 {
7169
font-weight: bold;
7270
}
@@ -79,12 +77,14 @@ h4 {
7977
margin-bottom: var(--collapsible-details-rhythm);
8078
}
8179

82-
/* most list content is formatted like paragraphs, with a little indent */
80+
/* Most list content is formatted with a little indent */
8381
.collapsible-details-list > li {
8482
list-style-type: disc;
8583
margin-left: var(--gap);
8684
border-bottom: none;
85+
margin-bottom: var(--gap); /* Add gap between <li> items */
8786
}
87+
8888
.collapsible-details-list > li:not(:last-of-type) {
8989
margin-bottom: calc(var(--gap) / 4);
9090
}
@@ -95,8 +95,40 @@ h4 {
9595
border-bottom: none;
9696
}
9797

98+
.collapsible-details {
99+
display: flex;
100+
flex-wrap: nowrap;
101+
width: 100%;
102+
box-sizing: border-box;
103+
}
98104

105+
/* Details section and circular progress section widths */
106+
.details-section1 {
107+
width: 70%; /* 70% of the width */
108+
padding-right: 20px; /* Optional: space between the sections */
109+
box-sizing: border-box; /* Ensures padding is included in the width calculation */
110+
}
99111

112+
.circular-progress-section {
113+
width: 30%; /* 30% of the width */
114+
display: flex;
115+
justify-content: center;
116+
align-items: center;
117+
padding-left: 20px; /* Optional: space between the sections */
118+
box-sizing: border-box; /* Ensures padding is included in the width calculation */
119+
}
100120

121+
/* Media Queries for responsive design */
122+
@media (max-width: 1024px) { /* Tablet and below */
123+
.details-section1,
124+
.circular-progress-section {
125+
width: 50%; /* On medium screens, each section will take 50% */
126+
}
127+
}
101128

102-
129+
@media (max-width: 600px) { /* Mobile and below */
130+
.details-section1,
131+
.circular-progress-section {
132+
width: 100%; /* Each section takes 100% on mobile screens */
133+
}
134+
}

0 commit comments

Comments
 (0)