Skip to content

Commit

Permalink
feat: add datatables
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWaldschmidt committed May 2, 2024
1 parent 0e189f9 commit 87ab288
Show file tree
Hide file tree
Showing 12 changed files with 557 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## v2.0.49

- Adds the `DataTable` component

## v2.0.48

- Add new icons for the `Icon` component
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lob/ui-components",
"version": "2.0.48",
"version": "2.0.49",
"engines": {
"node": ">=20.2.0",
"npm": ">=10.2.0"
Expand Down
Empty file.
115 changes: 115 additions & 0 deletions src/components/DataTable/DataTable.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import { Meta, StoryObj } from '@storybook/vue3';
import routeDecorator, {
routeTemplate
} from '../../../.storybook/routeDecorator';
import Column from 'primevue/column';
import DataTable from './DataTable.vue';
import mdx from './DataTable.mdx';

const meta: Meta<typeof DataTable> = {
title: 'Components/DataTable',
component: DataTable,
decorators: [
routeDecorator('/', [
{
path: '/internal',
name: 'InternalLink',
component: {
template: routeTemplate('internal')
}
}
])
],
parameters: {
docs: {
page: mdx
}
}
};

export default meta;

export const Primary: StoryObj<typeof DataTable> = {
render: (args) => ({
components: { Column, DataTable },
setup: () => ({ args }),
template: `
<DataTable v-bind="args">
<Column field="firstName" header="First Name" />
<Column field="lastName" header="Last Name" />
<Column field="favoriteColor" header="Favorite Color" />
</DataTable>
`
}),
args: {
dataKey: 'id',
data: [
{
id: 1,
firstName: 'John',
lastName: 'Doe',
favoriteColor: 'Blue'
},
{
id: 2,
firstName: 'Jane',
lastName: 'Doe',
favoriteColor: 'Green'
},
{
id: 3,
firstName: 'Jack',
lastName: 'Doe',
favoriteColor: 'Red'
},
{
id: 4,
firstName: 'Jill',
lastName: 'Doe',
favoriteColor: 'Yellow'
},
{
id: 5,
firstName: 'Jim',
lastName: 'Doe',
favoriteColor: 'Purple'
},
{
id: 6,
firstName: 'Jenny',
lastName: 'Doe',
favoriteColor: 'Orange'
},
{
id: 7,
firstName: 'Joe',
lastName: 'Doe',
favoriteColor: 'Black'
},
{
id: 8,
firstName: 'Jill',
lastName: 'Doe',
favoriteColor: 'White'
},
{
id: 9,
firstName: 'Jack',
lastName: 'Doe',
favoriteColor: 'Gray'
},
{
id: 10,
firstName: 'Jill',
lastName: 'Doe',
favoriteColor: 'Brown'
},
{
id: 11,
firstName: 'Jill',
lastName: 'Doe',
favoriteColor: 'Pink'
}
],
}
};

0 comments on commit 87ab288

Please sign in to comment.