File tree 3 files changed +17
-7
lines changed
3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ class MappingInputProvider extends HTMLElement {
96
96
//Box of detailed contents like image, description of mapping
97
97
const mappingIdsEndpoint = this . baseUrl . toString ( ) + "api/v1/mappingAdministration/" ;
98
98
let optionsContainer : HTMLElement = < HTMLInputElement > (
99
- this . shadowRoot . getElementById ( 'options-container' )
99
+ this . shadowRoot . getElementById ( 'options-container options-center ' )
100
100
) ;
101
101
// Remove any existing event listeners before adding a new one
102
102
optionsContainer . removeEventListener ( "click" , this . handleButtonClick . bind ( this ) ) ;
@@ -148,6 +148,11 @@ class MappingInputProvider extends HTMLElement {
148
148
} ) ;
149
149
}
150
150
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
+ }
151
156
} )
152
157
} ) . catch ( error => {
153
158
console . error ( 'Error while fetch Mapping Ids' + error )
Original file line number Diff line number Diff line change @@ -79,14 +79,19 @@ button:hover {
79
79
padding : 1.25rem ;
80
80
}
81
81
82
+ /* The common styles for options-container */
82
83
.options-container {
83
84
display : flex;
84
85
flex-wrap : nowrap;
85
- justify-content : center;
86
86
overflow-x : auto;
87
87
padding-bottom : 0.625rem ;
88
88
}
89
89
90
+ /* The class to center the container */
91
+ .options-center {
92
+ justify-content : center;
93
+ }
94
+
90
95
.cards {
91
96
flex : 0 0 calc (25% - 1.25rem );
92
97
display : flex;
@@ -101,16 +106,16 @@ button:hover {
101
106
margin : 0.625rem ;
102
107
overflow : hidden;
103
108
position : relative;
104
- min-width : 12 .5rem ;
109
+ min-width : 18 .5rem ;
105
110
/* Added minimum width for better mobile view */
106
111
background-color : # eef3f4 ;
107
112
/* Add your desired background color here */
108
- }
113
+ }
109
114
110
115
.cards img {
111
116
max-width : 6.25rem ;
112
117
margin-bottom : 0.625rem ;
113
- }
118
+ }
114
119
115
120
.cards h2 {
116
121
margin-bottom : 0.625rem ;
@@ -136,4 +141,4 @@ button:hover {
136
141
.section-heading {
137
142
/* background-color: #c52222; */
138
143
font-size : large;
139
- }
144
+ }
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ <h1 class="home-text08">Mapping Component</h1>
6
6
</ span >
7
7
</ div >
8
8
< div class ="container-wrapper ">
9
- < div id ="options-container " class ="options-container ">
9
+ < div id ="options-container options-center " class ="options-container ">
10
10
</ div >
11
11
</ div >
12
12
</ div >
You can’t perform that action at this time.
0 commit comments