diff --git a/next-ui/src/components.d.ts b/next-ui/src/components.d.ts index 91896b9fa..d97cb4833 100644 --- a/next-ui/src/components.d.ts +++ b/next-ui/src/components.d.ts @@ -42,8 +42,8 @@ declare module 'vue' { ImportBooksDirectorySelection: typeof import('./components/import/books/DirectorySelection.vue')['default'] ImportBooksTransientBooksTable: typeof import('./components/import/books/TransientBooksTable.vue')['default'] ImportReadlistTable: typeof import('./components/import/readlist/Table.vue')['default'] - ItemCard: typeof import('./components/item/ItemCard.vue')['default'] - ItemSeriesCard: typeof import('./components/item/SeriesCard.vue')['default'] + ItemCard: typeof import('./components/item/Card/ItemCard.vue')['default'] + ItemCardSeries: typeof import('./components/item/Card/Series.vue')['default'] LayoutAppBar: typeof import('./components/layout/app/Bar.vue')['default'] LayoutAppDrawer: typeof import('./components/layout/app/drawer/Drawer.vue')['default'] LayoutAppDrawerFooter: typeof import('./components/layout/app/drawer/Footer.vue')['default'] diff --git a/next-ui/src/components/item/ItemCard.stories.ts b/next-ui/src/components/item/Card/ItemCard.stories.ts similarity index 64% rename from next-ui/src/components/item/ItemCard.stories.ts rename to next-ui/src/components/item/Card/ItemCard.stories.ts index 194024f60..340dd02e7 100644 --- a/next-ui/src/components/item/ItemCard.stories.ts +++ b/next-ui/src/components/item/Card/ItemCard.stories.ts @@ -16,12 +16,20 @@ const meta = { }), parameters: { // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout + docs: { + description: { + component: 'A flexible card that serves as the base for entity cards.', + }, + }, }, args: { - title: 'Card title', + title: { text: 'Card title' }, posterUrl: seriesThumbnailUrl('id'), width: 150, onSelection: fn(), + onClickFab: fn(), + preSelect: false, + selected: false, }, } satisfies Meta @@ -30,32 +38,37 @@ type Story = StoryObj export const Default: Story = { args: { - line1: 'Line 1', - line2: 'Line 2', + lines: [{ text: 'Line 1' }, { text: 'Line 2' }], stretchPoster: true, }, } export const LongText: Story = { args: { - title: 'A very long title that will wrap', - line1: 'A very long title that will wrap', - line2: 'A very long title that will wrap', + title: { + text: 'Short 2 lines', + lines: 2, + }, + lines: [ + { + text: 'A very long title that will wrap but that is very long so it takes more lines', + lines: 2, + }, + { text: 'Short 2 lines', lines: 2 }, + ], stretchPoster: true, }, } export const EmptyLines: Story = { args: { - allowEmptyLine1: true, - allowEmptyLine2: true, + lines: [{ allowEmpty: true }, { allowEmpty: true }], }, } export const NoEmptyLines: Story = { args: { - allowEmptyLine1: false, - allowEmptyLine2: false, + lines: [{ allowEmpty: false }, { allowEmpty: false }], }, } @@ -78,9 +91,20 @@ export const SelectableHover: Story = { }, } +export const FabHover: Story = { + args: { + fabIcon: 'i-mdi:check', + disableSelection: true, + }, + play: ({ canvas, userEvent }) => { + userEvent.hover(canvas.getByRole('img')) + }, +} + export const Selected: Story = { args: { selected: true, + fabIcon: 'i-mdi:check', }, } @@ -92,8 +116,7 @@ export const PreSelect: Story = { export const Big: Story = { args: { - line1: 'Line 1', - line2: 'Line 2', + lines: [{ text: 'Line 1' }, { text: 'Line 2' }], width: 300, }, } diff --git a/next-ui/src/components/item/ItemCard.vue b/next-ui/src/components/item/Card/ItemCard.vue similarity index 63% rename from next-ui/src/components/item/ItemCard.vue rename to next-ui/src/components/item/Card/ItemCard.vue index 2ad5f7237..a11da58c7 100644 --- a/next-ui/src/components/item/ItemCard.vue +++ b/next-ui/src/components/item/Card/ItemCard.vue @@ -6,11 +6,10 @@ :disabled="overlayDisabled" >
+ + + +
- {{ title }} - {{ line1 }}{{ title.text }} - {{ line2 }} + {{ line.text }} + + diff --git a/next-ui/src/components/item/SeriesCard.stories.ts b/next-ui/src/components/item/Card/Series.stories.ts similarity index 81% rename from next-ui/src/components/item/SeriesCard.stories.ts rename to next-ui/src/components/item/Card/Series.stories.ts index ae9161215..b309ce419 100644 --- a/next-ui/src/components/item/SeriesCard.stories.ts +++ b/next-ui/src/components/item/Card/Series.stories.ts @@ -1,26 +1,31 @@ import type { Meta, StoryObj } from '@storybook/vue3-vite' -import SeriesCard from './SeriesCard.vue' +import Series from './Series.vue' import { mockSeries1 } from '@/mocks/api/handlers/series' import { fn } from 'storybook/test' const meta = { - component: SeriesCard, + component: Series, render: (args: object) => ({ - components: { SeriesCard }, + components: { Series }, setup() { return { args } }, - template: '', + template: '', }), parameters: { // More on how to position stories at: https://storybook.js.org/docs/configure/story-layout + docs: { + description: { + component: '', + }, + }, }, args: { series: mockSeries1, onSelection: fn(), }, -} satisfies Meta +} satisfies Meta export default meta type Story = StoryObj diff --git a/next-ui/src/components/item/Card/Series.vue b/next-ui/src/components/item/Card/Series.vue new file mode 100644 index 000000000..ab814cf5d --- /dev/null +++ b/next-ui/src/components/item/Card/Series.vue @@ -0,0 +1,74 @@ + + + diff --git a/next-ui/src/components/item/SeriesCard.vue b/next-ui/src/components/item/SeriesCard.vue deleted file mode 100644 index d6ad2b0c5..000000000 --- a/next-ui/src/components/item/SeriesCard.vue +++ /dev/null @@ -1,62 +0,0 @@ - - -