2021-06-29 12:27:46 +00:00
|
|
|
# ViewSelector
|
|
|
|
|
|
|
|
Actions with a button.
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
```js
|
|
|
|
import { ViewSelector } from "app-components";
|
|
|
|
```
|
|
|
|
|
|
|
|
### View Settings
|
|
|
|
|
|
|
|
```js
|
|
|
|
const viewSettings = [
|
|
|
|
{
|
2021-06-29 12:48:17 +00:00
|
|
|
value: "row",
|
2021-06-29 12:27:46 +00:00
|
|
|
icon: "/static/images/row.react.svg",
|
|
|
|
},
|
|
|
|
{
|
2021-06-29 12:48:17 +00:00
|
|
|
value: "tile",
|
2021-06-29 12:27:46 +00:00
|
|
|
|
|
|
|
icon: "/static/images/tile.react.svg",
|
|
|
|
callback: createThumbnails,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
```
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
<ViewSelector
|
|
|
|
isDisabled={false}
|
|
|
|
onChangeView={(view) => console.log("current view:", view)}
|
|
|
|
viewSettings={viewSettings}
|
|
|
|
viewAs="row"
|
|
|
|
/>
|
|
|
|
```
|
|
|
|
|
|
|
|
### Properties
|
|
|
|
|
|
|
|
| Props | Type | Required | Values | Default | Description |
|
|
|
|
| -------------- | :------: | :------: | :----: | :-----: | ---------------------------------------------- |
|
|
|
|
| `isDisabled` | `bool` | - | - | - | Disables the button default functionality |
|
|
|
|
| `onChangeView` | `func` | - | - | - | The event triggered when the button is clicked |
|
|
|
|
| `viewSettings` | `arr` | - | - | - | Array containing view settings. |
|
|
|
|
| `viewAs` | `string` | - | - | - | Current application view |
|