1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-01 21:57:06 +01:00
metamask-extension/ui/components/app/snaps/snap-settings-card
George Marshall bf61322ee1
Update Text import paths: /app (#20083)
* Updating import paths

* Updating snapshots

* Fixing lint issues

* Updating snapshots
2023-07-19 15:32:35 -07:00
..
index.js feat: add yaml feature management (#18125) 2023-04-25 16:32:51 +02:00
index.scss feat: add yaml feature management (#18125) 2023-04-25 16:32:51 +02:00
README.mdx feat: add yaml feature management (#18125) 2023-04-25 16:32:51 +02:00
snap-settings-card.js Update Text import paths: /app (#20083) 2023-07-19 15:32:35 -07:00
snap-settings-card.stories.js Clean up some code fencing around snaps (#18802) 2023-05-03 10:53:58 +02:00
snap-settings-card.test.js feat: add yaml feature management (#18125) 2023-04-25 16:32:51 +02:00

import { Story, Canvas, ArgsTable } from '@storybook/addon-docs';

import SnapSettingsCard from '.';

# SnapSettingsCard

A card component that displays information and the status of a snap. The `SnapSettingsCard` component is made up of the `Card`, `IconBorder`, `IconWithFallback`, `ToggleButton`, `Chip`, `ColorIndicator` and `Button` components

<Canvas>
  <Story id="components-app-flask-snapsettingscard--default-story" />
</Canvas>

## Props

<ArgsTable of={SnapSettingsCard} />

## Usage

The following describes the props and example usage for this component.

### Status

There are 4 statuses the `SnapSettingsCard` can have: `'installing'`,`'running'`,`'stopped'` and `'crashed'`.

<Canvas>
  <Story id="components-app-flask-snapsettingscard--status" />
</Canvas>

### isEnabled / onToggle

Use the `isEnabled` and `onToggle` to control the `ToggleButton` component inside of the `SnapSettingsCard`

```jsx
const [isEnabled, setIsEnabled] = React.useState(false);

const handleOnToggle = () => {
  setIsEnabled(!isEnabled);
};

return <SnapSettingsCard isEnabled={isEnabled} onToggle={handleOnToggle} />;
```