Skip to content

Commit

Permalink
feat(BaseTabSlider): remove lenght property, now computed from tabs l…
Browse files Browse the repository at this point in the history
…ength
  • Loading branch information
stafyniaksacha committed Aug 12, 2023
1 parent 9b541c1 commit 2efd031
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions components/base/BaseTabSlider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ const props = withDefaults(
* Controls the alignment of the tabs. Can be 'start', 'center', or 'end'.
*/
justify?: 'start' | 'center' | 'end'
/**
* Controls the number of tabs displayed in a row. Can be 2 or 3.
*/
length?: 2 | 3
/**
* The size of the tabs.
*/
Expand Down Expand Up @@ -68,8 +64,9 @@ const shapeStyle = {
full: 'nui-tabs-full',
}
const tabsLength = computed(() => Math.min(3, Math.max(2, props.tabs.length)))
const lengthStyle = computed(() =>
props.length === 2 ? 'nui-tabs-two-slots' : 'nui-tabs-three-slots'
tabsLength.value === 2 ? 'nui-tabs-two-slots' : 'nui-tabs-three-slots'
)
const activeValue = ref<string | undefined>(
Expand Down Expand Up @@ -104,7 +101,7 @@ watch(activeValue, (value) => {
<div class="nui-tab-slider-inner">
<div class="nui-tab-slider-track">
<button
v-for="(tab, index) in tabs.slice(0, props.length)"
v-for="(tab, index) in tabs.slice(0, tabsLength)"
:key="index"
type="button"
class="nui-tab-slider-item"
Expand Down

0 comments on commit 2efd031

Please sign in to comment.