Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* WordPress dependencies
*/
import { useState } from '@wordpress/element';

/**
* Internal dependencies
*/
import DataForm from '../index';

const meta = {
title: 'DataViews/DataForm',
component: DataForm,
};
export default meta;

const fields = [
{
id: 'title',
label: 'Title',
type: 'text' as const,
},
];

export const Default = () => {
const [ post, setPost ] = useState( {
title: 'Hello, World!',
} );

const form = {
visibleFields: [ 'title' ],
};

return (
<DataForm
data={ post }
fields={ fields }
form={ form }
onChange={ setPost }
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
/**
* Internal dependencies
*/
import { LAYOUT_TABLE } from '../constants';
import { LAYOUT_TABLE } from '../../../constants';

export const data = [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { useState, useMemo } from '@wordpress/element';
/**
* Internal dependencies
*/
import { DataViews } from '../index';
import DataViews from '../index';
import { DEFAULT_VIEW, actions, data, fields } from './fixtures';
import { LAYOUT_GRID, LAYOUT_TABLE } from '../constants';
import { filterSortAndPaginate } from '../filter-and-sort-data-view';
import { LAYOUT_GRID, LAYOUT_TABLE } from '../../../constants';
import { filterSortAndPaginate } from '../../../filter-and-sort-data-view';

const meta = {
title: 'DataViews/DataViews',
Expand Down
2 changes: 1 addition & 1 deletion packages/dataviews/src/test/filter-and-sort-data-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Internal dependencies
*/
import { filterSortAndPaginate } from '../filter-and-sort-data-view';
import { data, fields } from '../stories/fixtures';
import { data, fields } from '../components/dataviews/stories/fixtures';

describe( 'filters', () => {
it( 'should return empty if the data is empty', () => {
Expand Down