Skip to content

Commit 0890226

Browse files
committed
fix: css issue : title overlapping, issue with odd no. of boxes fixed
1 parent 385d561 commit 0890226

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

src/main.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class MappingInputProvider extends HTMLElement {
9696
//Box of detailed contents like image, description of mapping
9797
const mappingIdsEndpoint = this.baseUrl.toString() + "api/v1/mappingAdministration/";
9898
let optionsContainer: HTMLElement = <HTMLInputElement>(
99-
this.shadowRoot.getElementById('options-container')
99+
this.shadowRoot.getElementById('options-container options-center')
100100
);
101101
// Remove any existing event listeners before adding a new one
102102
optionsContainer.removeEventListener("click", this.handleButtonClick.bind(this));
@@ -148,6 +148,11 @@ class MappingInputProvider extends HTMLElement {
148148
});
149149
}
150150
optionsContainer.appendChild(division);
151+
if (mappingIds.length < 5) {
152+
optionsContainer.classList.add('options-center'); // Add the class if less than 5 cards
153+
} else {
154+
optionsContainer.classList.remove('options-center'); // Remove the class if more than 5 cards
155+
}
151156
})
152157
}).catch(error => {
153158
console.error('Error while fetch Mapping Ids' + error)

src/style.css

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,19 @@ button:hover {
7979
padding: 1.25rem;
8080
}
8181

82+
/* The common styles for options-container */
8283
.options-container {
8384
display: flex;
8485
flex-wrap: nowrap;
85-
justify-content: center;
8686
overflow-x: auto;
8787
padding-bottom: 0.625rem;
8888
}
8989

90+
/* The class to center the container */
91+
.options-center {
92+
justify-content: center;
93+
}
94+
9095
.cards {
9196
flex: 0 0 calc(25% - 1.25rem);
9297
display: flex;
@@ -101,16 +106,16 @@ button:hover {
101106
margin: 0.625rem;
102107
overflow: hidden;
103108
position: relative;
104-
min-width: 12.5rem;
109+
min-width: 18.5rem;
105110
/* Added minimum width for better mobile view */
106111
background-color: #eef3f4;
107112
/* Add your desired background color here */
108-
}
113+
}
109114

110115
.cards img {
111116
max-width: 6.25rem;
112117
margin-bottom: 0.625rem;
113-
}
118+
}
114119

115120
.cards h2 {
116121
margin-bottom: 0.625rem;
@@ -136,4 +141,4 @@ button:hover {
136141
.section-heading {
137142
/* background-color: #c52222; */
138143
font-size: large;
139-
}
144+
}

src/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ <h1 class="home-text08">Mapping Component</h1>
66
</span>
77
</div>
88
<div class="container-wrapper">
9-
<div id="options-container" class="options-container">
9+
<div id="options-container options-center" class="options-container">
1010
</div>
1111
</div>
1212
</div>

0 commit comments

Comments
 (0)