|
13 | 13 | v-if="hasMultipleTabs || showForSingleTab" |
14 | 14 | role="tablist" |
15 | 15 | class="app-sidebar-tabs__nav" |
| 16 | + :class="{ 'app-sidebar-tabs__nav--legacy': isLegacy34 }" |
16 | 17 | @keydown.left.exact.prevent.stop="focusPreviousTab" |
17 | 18 | @keydown.right.exact.prevent.stop="focusNextTab" |
18 | 19 | @keydown.tab.exact.prevent.stop="focusActiveTabContent" |
|
59 | 60 | <script> |
60 | 61 | import NcCheckboxRadioSwitch from '../NcCheckboxRadioSwitch/index.js' |
61 | 62 | import NcVNodes from '../NcVNodes/index.js' |
| 63 | +import { isLegacy34 } from '../../utils/legacy.ts' |
62 | 64 |
|
63 | 65 | export default { |
64 | 66 | name: 'NcAppSidebarTabs', |
@@ -109,6 +111,7 @@ export default { |
109 | 111 | * Local active (open) tab's ID. It allows to use component without active.sync |
110 | 112 | */ |
111 | 113 | activeTab: '', |
| 114 | + isLegacy34, |
112 | 115 | } |
113 | 116 | }, |
114 | 117 |
|
@@ -269,23 +272,96 @@ export default { |
269 | 272 | margin: 10px 8px 0 8px; |
270 | 273 | border-bottom: 1px solid var(--color-border); |
271 | 274 |
|
272 | | - // Override checkbox-radio-switch styles so that it looks like tabs |
273 | | - & :deep(.checkbox-radio-switch--button-variant) { |
274 | | - border: unset !important; |
275 | | - border-radius: 0 !important; |
276 | | - .checkbox-content { |
277 | | - padding: var(--default-grid-baseline); |
278 | | - border-radius: var(--default-grid-baseline) var(--default-grid-baseline) 0 0 !important; |
279 | | - margin: 0 !important; |
280 | | - border-bottom: var(--default-grid-baseline) solid transparent !important; |
281 | | - .checkbox-content__icon > * { |
282 | | - color: var(--color-main-text) !important; |
| 275 | + // New design (NC34+): rounded pill tabs with a small primary indicator |
| 276 | + // under the active tab. |
| 277 | + &:not(&--legacy) { |
| 278 | + gap: var(--default-grid-baseline); |
| 279 | + padding-block-end: var(--default-grid-baseline); |
| 280 | +
|
| 281 | + & :deep(.checkbox-radio-switch--button-variant) { |
| 282 | + position: relative; |
| 283 | + border: unset !important; |
| 284 | + border-radius: var(--border-radius-element) !important; |
| 285 | + background-color: var(--color-main-background); |
| 286 | + min-width: var(--default-clickable-area); |
| 287 | + transition: background-color var(--animation-quick); |
| 288 | +
|
| 289 | + .checkbox-content { |
| 290 | + padding: var(--default-grid-baseline); |
| 291 | + padding-block-end: calc(var(--default-grid-baseline) * 2); |
| 292 | + border-radius: var(--border-radius-element) !important; |
| 293 | + margin: 0 !important; |
| 294 | + .checkbox-content__icon > * { |
| 295 | + color: var(--color-main-text) !important; |
| 296 | + } |
| 297 | + } |
| 298 | +
|
| 299 | + .checkbox-content__text { |
| 300 | + font-weight: var(--font-weight-element, normal); |
| 301 | + } |
| 302 | +
|
| 303 | + &::after { |
| 304 | + content: ''; |
| 305 | + position: absolute; |
| 306 | + bottom: 0; |
| 307 | + left: 50%; |
| 308 | + width: 0; |
| 309 | + height: 6px; |
| 310 | + border-radius: 999px; |
| 311 | + background-color: var(--color-primary-element); |
| 312 | + opacity: 0; |
| 313 | + transform: translateX(-50%); |
| 314 | + transition: width var(--animation-quick), opacity var(--animation-quick); |
| 315 | + } |
| 316 | +
|
| 317 | + &:hover { |
| 318 | + background-color: var(--color-background-hover); |
| 319 | + } |
| 320 | +
|
| 321 | + &:focus-visible { |
| 322 | + outline: 2px solid var(--color-main-text); |
| 323 | + outline-offset: 2px; |
| 324 | + } |
| 325 | +
|
| 326 | + &.checkbox-radio-switch--checked { |
| 327 | + background-color: var(--color-background-hover) !important; |
| 328 | + .checkbox-radio-switch__content { |
| 329 | + background: transparent !important; |
| 330 | + color: var(--color-main-text) !important; |
| 331 | + } |
| 332 | + &::after { |
| 333 | + width: 80%; |
| 334 | + opacity: 1; |
| 335 | + } |
| 336 | + &:hover { |
| 337 | + background-color: var(--color-background-dark) !important; |
| 338 | + } |
283 | 339 | } |
284 | 340 | } |
285 | | - &.checkbox-radio-switch--checked .checkbox-radio-switch__content{ |
286 | | - background: transparent !important; |
287 | | - color: var(--color-main-text) !important; |
288 | | - border-bottom: var(--default-grid-baseline) solid var(--color-primary-element) !important; |
| 341 | + } |
| 342 | +
|
| 343 | + // Legacy design (NC < 34): full-width primary border under the active tab. |
| 344 | + &--legacy { |
| 345 | + & :deep(.checkbox-radio-switch--button-variant) { |
| 346 | + border: unset !important; |
| 347 | + border-radius: 0 !important; |
| 348 | + .checkbox-content { |
| 349 | + padding: var(--default-grid-baseline); |
| 350 | + border-radius: var(--default-grid-baseline) var(--default-grid-baseline) 0 0 !important; |
| 351 | + margin: 0 !important; |
| 352 | + border-bottom: var(--default-grid-baseline) solid transparent !important; |
| 353 | + .checkbox-content__icon > * { |
| 354 | + color: var(--color-main-text) !important; |
| 355 | + } |
| 356 | + } |
| 357 | + &.checkbox-radio-switch--checked .checkbox-radio-switch__content{ |
| 358 | + background: transparent !important; |
| 359 | + color: var(--color-main-text) !important; |
| 360 | + border-bottom: var(--default-grid-baseline) solid var(--color-primary-element) !important; |
| 361 | + } |
| 362 | + &.checkbox-radio-switch--checked .checkbox-content__text { |
| 363 | + font-weight: var(--font-weight-element, bold); |
| 364 | + } |
289 | 365 | } |
290 | 366 | } |
291 | 367 | } |
|
0 commit comments