Skip to content

Commit

Permalink
item -> segment
Browse files Browse the repository at this point in the history
  • Loading branch information
kiaking committed Jan 22, 2025
1 parent 035cd30 commit 7f0ffb9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/components/STableCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const computedCell = computed<TableCell | undefined>(() =>
/>
<STableCellPath
v-else-if="computedCell.type === 'path'"
:items="computedCell.items"
:segments="computedCell.segments"
/>
<STableCellDay
v-else-if="computedCell.type === 'day'"
Expand Down
16 changes: 8 additions & 8 deletions lib/components/STableCellPath.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script setup lang="ts">
import { type TableCellPathItem } from '../composables/Table'
import { type TableCellPathSegment } from '../composables/Table'
import SLink from './SLink.vue'
defineProps<{
items: TableCellPathItem[]
segments: TableCellPathSegment[]
}>()
function classes(item: TableCellPathItem) {
function classes(item: TableCellPathSegment) {
return [
item.color ?? 'neutral',
{ link: !!item.link || !!item.onClick }
Expand All @@ -16,15 +16,15 @@ function classes(item: TableCellPathItem) {

<template>
<div class="STableCellPath">
<template v-for="item, index in items" :key="index">
<template v-for="segment, index in segments" :key="index">
<div v-if="index > 0" class="divider">/</div>
<SLink
class="text"
:class="classes(item)"
:href="item.link"
@click="item.onClick"
:class="classes(segment)"
:href="segment.link"
@click="segment.onClick"
>
{{ item.text }}
{{ segment.text }}
</SLink>
</template>
</div>
Expand Down
4 changes: 2 additions & 2 deletions lib/composables/Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ export interface TableCellNumber<V = any, R = any> extends TableCellBase {

export interface TableCellPath extends TableCellBase {
type: 'path'
items: TableCellPathItem[]
segments: TableCellPathSegment[]
}

export interface TableCellPathItem {
export interface TableCellPathSegment {
text: string
link?: string | null
color?: TableCellValueColor
Expand Down

0 comments on commit 7f0ffb9

Please sign in to comment.