Skip to content

Commit

Permalink
feat(filters): update file structure for filters, rename 'FiltersList…
Browse files Browse the repository at this point in the history
…' to be 'Filters', make 'FilterMenu' and 'Badge' sub-components in 'Filters', update all tests/generated files, add file structure for 'QuickFilters', update build steps in root package.json to not treat 'components/filters' as a build directory (#2932)
  • Loading branch information
ByronDWall authored Oct 1, 2024
1 parent 58fe325 commit 13e4f0a
Show file tree
Hide file tree
Showing 60 changed files with 198 additions and 179 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"packages/components/buttons/*",
"packages/components/dropdowns/*",
"packages/components/fields/*",
"packages/components/filters/*",
"packages/components/inputs/*",
"packages/components/spacings/*",
"presets/*",
Expand All @@ -63,7 +62,6 @@
"packages/components/buttons/*",
"packages/components/dropdowns/*",
"packages/components/fields/*",
"packages/components/filters/*",
"packages/components/inputs/*",
"packages/components/spacings/*",
"presets/*"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<!-- THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -->
<!-- This file is created by the `yarn generate-readme` script. -->

# FiltersList
# Filters

## Description

The FiltersList component displays all active filters. It also allows for adding and removing filters.
The `Filters` component displays all active filters. It also allows for adding and removing filters.

This description is a stub and shold be expanded as development continues.

## Installation

```
yarn add @commercetools-uikit/filters-list
yarn add @commercetools-uikit/filters
```

```
npm --save install @commercetools-uikit/filters-list
npm --save install @commercetools-uikit/filters
```

Additionally install the peer dependencies (if not present)
Expand All @@ -32,10 +32,10 @@ npm --save install react
## Usage

```jsx
import FiltersList from '@commercetools-uikit/filters-list';
import Filters from '@commercetools-uikit/filters';

/**TODO: EXPAND THIS */
const Example = () => <FiltersList />;
const Example = () => <Filters />;

export default Example;
```
Expand Down
3 changes: 3 additions & 0 deletions packages/components/filters/docs/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The `Filters` component displays all active filters. It also allows for adding and removing filters.

This description is a stub and shold be expanded as development continues.
6 changes: 6 additions & 0 deletions packages/components/filters/docs/usage-example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Filters from '@commercetools-uikit/filters';

/**TODO: EXPAND THIS */
const Example = () => <Filters />;

export default Example;
49 changes: 0 additions & 49 deletions packages/components/filters/filter-menu/README.md

This file was deleted.

5 changes: 0 additions & 5 deletions packages/components/filters/filter-menu/docs/description.md

This file was deleted.

6 changes: 0 additions & 6 deletions packages/components/filters/filter-menu/docs/usage-example.js

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions packages/components/filters/filters-list/docs/description.md

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions packages/components/filters/filters-list/src/filters-list.tsx

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@commercetools-uikit/filter-menu",
"description": "The `FilterMenu` is the menu that displays the available and selected options for a specific filter in the `FiltersList`.",
"name": "@commercetools-uikit/filters",
"description": "The `Filters` component displays filter controls.",
"version": "19.11.0",
"bugs": "https://github.com/commercetools/ui-kit/issues",
"repository": {
"type": "git",
"url": "https://github.com/commercetools/ui-kit.git",
"directory": "packages/components/filters/filter-menu"
"directory": "packages/components/filters"
},
"homepage": "https://uikit.commercetools.com",
"keywords": ["javascript", "typescript", "design-system", "react", "uikit"],
Expand All @@ -15,8 +15,8 @@
"access": "public"
},
"sideEffects": false,
"main": "dist/commercetools-uikit-filter-menu.cjs.js",
"module": "dist/commercetools-uikit-filter-menu.esm.js",
"main": "dist/commercetools-uikit-filters.cjs.js",
"module": "dist/commercetools-uikit-filters.esm.js",
"files": ["dist"],
"dependencies": {
"@babel/runtime": "^7.20.13",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { screen, render } from '../../../../../../test/test-utils';
import { screen, render } from '../../../../../test/test-utils';
import Badge from './badge';

/**
Expand Down
1 change: 1 addition & 0 deletions packages/components/filters/src/export-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type { TFiltersProps } from './filters';
1 change: 1 addition & 0 deletions packages/components/filters/src/filter-menu/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './filter-menu';
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Badge } from '../badge';
import { Badge } from '../../badge';
import { Chip } from '../chip';

export type TFilterMenuTriggerButtonProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Meta, Markdown } from '@storybook/blocks';
import ReadMe from './../README.md?raw'

<Meta tags={['local-dev']} title="components/Filters/FilterMenu/Readme" />
<Meta tags={['local-dev']} title="components/Filters/Readme" />

<Markdown>{ReadMe}</Markdown>
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { screen, render } from '../../../../../test/test-utils';
import FiltersList from './filters-list';
import { screen, render } from '../../../../test/test-utils';
import Filters from './filters';

/**
* THIS IS A PLACEHOLDER, PLEASE UPDATE IT
*/
describe('FilterMenu FiltersList', () => {
it('should render the filters-list', async () => {
await render(<FiltersList label="filters list" />);
await render(<Filters label="filters list" />);
await screen.findByText('filters list');
});
});
22 changes: 22 additions & 0 deletions packages/components/filters/src/filters.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { Meta, StoryObj } from '@storybook/react';
import Filters from './filters';

const meta: Meta<typeof Filters> = {
title: 'components/Filters',
component: Filters,
tags: ['local-dev'],
argTypes: {
label: {
control: 'text',
},
},
};
export default meta;

type Story = StoryObj<typeof Filters>;

export const BasicExample: Story = {
args: {
label: 'A component for applying multiple filter controls',
},
};
11 changes: 11 additions & 0 deletions packages/components/filters/src/filters.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export type TFiltersProps = {
/**
* This is a stub prop
*/
label?: string;
};

function Filters(props: TFiltersProps) {
return <div>{props.label}</div>;
}
export default Filters;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Suite, Spec } from '../../../../../test/percy';
import { Suite, Spec } from '../../../../test/percy';

export const routePath = '/filter-menu';
export const routePath = '/filters';

export const component = () => (
<Suite>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getDocument, queries } from 'pptr-testing-library';

describe('FiltersList', () => {
beforeAll(async () => {
await page.goto(`${globalThis.HOST}/filters-list`);
await page.goto(`${globalThis.HOST}/filters`);
});

it.skip('Default', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default } from './filter-menu';
export { default } from './filters';
export { default as version } from './version';
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
47 changes: 47 additions & 0 deletions packages/components/quick-filters/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!-- THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -->
<!-- This file is created by the `yarn generate-readme` script. -->

# QuickFilters

## Description

The `QuickFilters` component displays a selection of `Tag` components that represent the available filter actions.

This description is a stub and shold be expanded as development continues.

## Installation

```
yarn add @commercetools-uikit/quick-filters
```

```
npm --save install @commercetools-uikit/quick-filters
```

Additionally install the peer dependencies (if not present)

```
yarn add react
```

```
npm --save install react
```

## Usage

```jsx
import QuickFilters from '@commercetools-uikit/quick-filters';

/**TODO: EXPAND THIS */
const Example = () => <QuickFilters />;

export default Example;
```

## Properties

| Props | Type | Required | Default | Description |
| ------- | -------- | :------: | ------- | -------------------- |
| `label` | `string` || | This is a stub prop! |
3 changes: 3 additions & 0 deletions packages/components/quick-filters/docs/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The `QuickFilters` component displays a selection of `Tag` components that represent the available filter actions.

This description is a stub and shold be expanded as development continues.
6 changes: 6 additions & 0 deletions packages/components/quick-filters/docs/usage-example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import QuickFilters from '@commercetools-uikit/quick-filters';

/**TODO: EXPAND THIS */
const Example = () => <QuickFilters />;

export default Example;
File renamed without changes.
Loading

0 comments on commit 13e4f0a

Please sign in to comment.