Skip to content

Commit c0b440c

Browse files
committed
fix(banner): improve default banner styles
- Fix layout with proper flexbox structure - Update to cleaner color scheme (white bg, better contrast) - Improve spacing and typography - Better dark mode support - More professional button styles - Responsive mobile layout improvements
1 parent d6c895c commit c0b440c

File tree

1 file changed

+75
-50
lines changed

1 file changed

+75
-50
lines changed

packages/plugins/src/banner/banner.ts

Lines changed: 75 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,12 @@ export const bannerPlugin: PluginFunction = (plugin, instance, config) => {
6969
left: 0;
7070
right: 0;
7171
width: 100%;
72-
padding: 16px 20px;
7372
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
7473
font-size: 14px;
7574
line-height: 1.5;
76-
display: flex;
77-
align-items: center;
78-
justify-content: space-between;
7975
box-sizing: border-box;
8076
z-index: 10000;
81-
background: #f9fafb;
77+
background: #ffffff;
8278
color: #111827;
8379
border-bottom: 1px solid #e5e7eb;
8480
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
@@ -98,33 +94,38 @@ export const bannerPlugin: PluginFunction = (plugin, instance, config) => {
9894
.xp-banner__container {
9995
display: flex;
10096
align-items: center;
101-
justify-content: space-between;
102-
gap: 20px;
103-
width: 100%;
97+
gap: 16px;
98+
max-width: 1280px;
99+
margin: 0 auto;
100+
padding: 14px 24px;
104101
}
105102
106103
.xp-banner__content {
107104
flex: 1;
108105
min-width: 0;
106+
display: flex;
107+
flex-direction: column;
108+
gap: 4px;
109109
}
110110
111111
.xp-banner__title {
112112
font-weight: 600;
113-
margin-bottom: 4px;
114-
margin-top: 0;
115-
font-size: 14px;
113+
margin: 0;
114+
font-size: 15px;
115+
line-height: 1.4;
116116
}
117117
118118
.xp-banner__message {
119119
margin: 0;
120120
font-size: 14px;
121+
line-height: 1.5;
122+
color: #6b7280;
121123
}
122124
123125
.xp-banner__buttons {
124126
display: flex;
125127
align-items: center;
126-
gap: 12px;
127-
flex-wrap: wrap;
128+
gap: 8px;
128129
flex-shrink: 0;
129130
}
130131
@@ -137,6 +138,10 @@ export const bannerPlugin: PluginFunction = (plugin, instance, config) => {
137138
cursor: pointer;
138139
transition: all 0.2s;
139140
text-decoration: none;
141+
display: inline-flex;
142+
align-items: center;
143+
justify-content: center;
144+
white-space: nowrap;
140145
}
141146
142147
.xp-banner__button--primary {
@@ -149,71 +154,93 @@ export const bannerPlugin: PluginFunction = (plugin, instance, config) => {
149154
}
150155
151156
.xp-banner__button--secondary {
152-
background: #ffffff;
157+
background: #f3f4f6;
153158
color: #374151;
154-
border: 1px solid #d1d5db;
159+
border: 1px solid #e5e7eb;
155160
}
156161
157162
.xp-banner__button--secondary:hover {
158-
background: #f9fafb;
163+
background: #e5e7eb;
159164
}
160165
161166
.xp-banner__button--link {
162167
background: transparent;
163168
color: #2563eb;
164-
padding: 4px 8px;
169+
padding: 6px 12px;
165170
font-weight: 400;
166-
text-decoration: underline;
167171
}
168172
169173
.xp-banner__button--link:hover {
170-
background: rgba(0, 0, 0, 0.05);
174+
background: #f3f4f6;
175+
text-decoration: underline;
171176
}
172177
173178
.xp-banner__close {
174179
background: transparent;
175180
border: none;
176-
color: #6b7280;
177-
font-size: 24px;
181+
color: #9ca3af;
182+
font-size: 20px;
178183
line-height: 1;
179184
cursor: pointer;
180-
padding: 0;
185+
padding: 4px;
181186
margin: 0;
182-
opacity: 0.7;
183-
transition: opacity 0.2s;
187+
transition: color 0.2s;
184188
flex-shrink: 0;
189+
width: 28px;
190+
height: 28px;
191+
display: flex;
192+
align-items: center;
193+
justify-content: center;
194+
border-radius: 4px;
185195
}
186196
187197
.xp-banner__close:hover {
188-
opacity: 1;
198+
color: #111827;
199+
background: #f3f4f6;
189200
}
190201
191202
@media (max-width: 640px) {
192203
.xp-banner__container {
193-
flex-direction: column;
194-
align-items: stretch;
204+
flex-wrap: wrap;
205+
padding: 14px 16px;
206+
position: relative;
207+
}
208+
209+
.xp-banner__content {
210+
flex: 1 1 100%;
211+
padding-right: 32px;
195212
}
196213
197214
.xp-banner__buttons {
215+
flex: 1 1 auto;
198216
width: 100%;
199-
flex-direction: column;
200217
}
201218
202219
.xp-banner__button {
203-
width: 100%;
220+
flex: 1;
221+
}
222+
223+
.xp-banner__close {
224+
position: absolute;
225+
top: 12px;
226+
right: 12px;
204227
}
205228
}
206229
207230
/* Dark mode support */
208231
@media (prefers-color-scheme: dark) {
209232
.xp-banner {
210-
background: #1f2937;
211-
color: #f3f4f6;
212-
border-bottom-color: #374151;
233+
background: #111827;
234+
color: #f9fafb;
235+
border-bottom-color: #1f2937;
213236
}
214237
215238
.xp-banner--bottom {
216-
border-top-color: #374151;
239+
border-top-color: #1f2937;
240+
}
241+
242+
.xp-banner__message {
243+
color: #9ca3af;
217244
}
218245
219246
.xp-banner__button--primary {
@@ -225,21 +252,30 @@ export const bannerPlugin: PluginFunction = (plugin, instance, config) => {
225252
}
226253
227254
.xp-banner__button--secondary {
228-
background: #374151;
229-
color: #f3f4f6;
230-
border-color: #4b5563;
255+
background: #1f2937;
256+
color: #f9fafb;
257+
border-color: #374151;
231258
}
232259
233260
.xp-banner__button--secondary:hover {
234-
background: #4b5563;
261+
background: #374151;
235262
}
236263
237264
.xp-banner__button--link {
238-
color: #93c5fd;
265+
color: #60a5fa;
266+
}
267+
268+
.xp-banner__button--link:hover {
269+
background: #1f2937;
239270
}
240271
241272
.xp-banner__close {
242-
color: #9ca3af;
273+
color: #6b7280;
274+
}
275+
276+
.xp-banner__close:hover {
277+
color: #f9fafb;
278+
background: #1f2937;
243279
}
244280
}
245281
`;
@@ -307,17 +343,6 @@ export const bannerPlugin: PluginFunction = (plugin, instance, config) => {
307343

308344
container.appendChild(contentDiv);
309345

310-
banner.appendChild(contentDiv);
311-
312-
// Create button container for actions and/or dismiss
313-
const buttonContainer = document.createElement('div');
314-
buttonContainer.style.cssText = `
315-
display: flex;
316-
align-items: center;
317-
gap: 12px;
318-
flex-wrap: wrap;
319-
`;
320-
321346
// Create buttons container
322347
const buttonsDiv = document.createElement('div');
323348
buttonsDiv.className = 'xp-banner__buttons';

0 commit comments

Comments
 (0)