# @wedgekit/layout

> @wedgkit/layout exports components that should be used to generate standard screen layouts that are approved by the design system.

Latest version **2.2.0** (published 2023-03-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @wedgekit/layout
pnpm add @wedgekit/layout
yarn add @wedgekit/layout
bun add @wedgekit/layout
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2023-03-14 |
| First published | 2019-07-31 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 44.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | brent-heavican, lphipps, msuiter, rerskine, daniel.z, timmy2654, jfiller, mada1113, hbiede.dmsi, bpowers_dmsi, jaradpiniarski, kolson, dreadman3716, zkerkman |

## Links

- npm: https://www.npmjs.com/package/@wedgekit/layout
- Repository: https://design.dmsi.com/
- npm.io page: https://npm.io/package/@wedgekit/layout

## Dependencies (2)

- [@wedgekit/color](https://npm.io/package/@wedgekit/color.md) 4.6.0
- [@wedgekit/primitives](https://npm.io/package/@wedgekit/primitives.md) 5.0.1

## Recent versions

- 2.2.0 (latest) — 2023-03-14
- 2.1.3-tc.10 (test) — 2022-12-27
- 2.1.2-tc.1 (tets) — 2022-10-03
- 2.1.3-tc.2 — 2022-12-20
- 2.1.3-tc.1 — 2022-12-20
- 2.1.3-tc.0 — 2022-12-20
- 2.1.2 — 2022-11-09
- 2.1.2-tc.18 — 2022-10-17
- 2.1.2-tc.17 — 2022-10-17
- 2.1.2-tc.16 — 2022-10-17
- 2.1.2-tc.15 — 2022-10-17
- 2.1.2-tc.14 — 2022-10-14
- 2.1.2-tc.13 — 2022-10-14
- 2.1.2-tc.12 — 2022-10-14
- 2.1.2-tc.11 — 2022-10-14
- … 98 more at https://npm.io/package/@wedgekit/layout/versions

## README

# Layout

@wedgkit/layout exports components that should be used to generate standard screen layouts that are approved by the design system.

## Layout.App

`Layout.App` consists of a layout with optional headers, drawers and notifications that match the design system.

#### Example

```jsx
import Layout from '@wedgekit/layout';
import color from '@wedgekit/color';
import styled from 'styled-components';

const HeaderContainer = styled.div`
  background: ${color.N700};
  color: ${color.N050};
  padding: 8px;
`;

const ResourceContainer = styled.div`
  background: ${color.N200};
  height: 50vh;
  padding: 8px;
`;

const NotificationContainer = styled.div`
  background: ${color.R100};
  padding: 8px;
`;

const Example = () => {
  return (
    <Layout.App
      header={<HeaderContainer>Header</HeaderContainer>}
      resource={<ResourceContainer>Resource</ResourceContainer>}
      notifications={<NotificationContainer>Notification</NotificationContainer>}
      resourceMounted
      resourceType="drawer"
      drawerLeft
      drawerWidth="10vw"
    >
      {() => <div style={{ padding: '40px' }}>Content</div>}
    </Layout.App>
  );
};

render(<Example />);
```

#### API

| Prop            | Required | Type                                                          | Default | Description                                                                                                                                                                                                                                                                                                                                                                         |
| --------------- | -------- | ------------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| header          | ❌       | `JSX.Element`                                                 | null    | An application header designed to be placed at the top of the app                                                                                                                                                                                                                                                                                                                   |
| notifications   | ❌       | `JSX.Element`                                                 | null    | Notifications/Alerts components to be rendered below the header and above the rest of the content.                                                                                                                                                                                                                                                                                  |
| resource        | ❌       | `JSX.Element`                                                 |         | A resource to be rendered when `resourceMounted` is `true`                                                                                                                                                                                                                                                                                                                          |
| resourceMounted | ❌       | `boolean`                                                     | false   | Whether or not the resource is mounted                                                                                                                                                                                                                                                                                                                                              |
| resourceType    | ❌       | `'drawer'/'drawer-overlay'/'drawer-unstyled'/'drawer-mobile'` | ''      | The type of resource mounting the App will perform. The default drawer type will apply standard padding and scrolling. The overlay drawer will dim the rest of the screen act similarly to a modal. The unstyled drawer is similar to the default drawer with all styling removed (use this with render sticky action rows). The mobile drawer is best used in mobile applications. |
| drawerLeft      | ❌       | `boolean`                                                     | false   | When true show the drawer on the left side of the screen                                                                                                                                                                                                                                                                                                                            |
| drawerWidth     | ❌       | `string`                                                      |         | Custom size to set as the drawer width                                                                                                                                                                                                                                                                                                                                              |

## Layout.Grid

`Layout.Grid` is a dynamic grid that can resize children components relative to the view window's dimension.

#### Usage

```jsx
import Layout from '@wedgekit/layout';
import color from '@wedgekit/color';

const Example = () => {
  return (
    <>
      <Layout.Grid
        areas={['red blue green']}
        rows={['20vh']}
        areasLg={['red blue', 'green .']}
        rowsLg={['20vh', '20vh']}
        areasMd={['red', 'blue', 'green']}
        rowsMd={['20vh', '20vh', '20vh']}
      >
        <Layout.Section area="red" style={{ background: 'red' }}>
          Red
        </Layout.Section>
        <Layout.Section area="blue" style={{ background: 'blue' }}>
          Blue
        </Layout.Section>
        <Layout.Section area="green" style={{ background: 'Green' }}>
          green
        </Layout.Section>
      </Layout.Grid>
      Shrink/Expand your browser to see the boxes arrange themselves.
    </>
  );
};

render(<Example />);
```

#### API

| Prop         | Required | Type            | Description                                                                                                                                                                                                                                         |
| ------------ | -------- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| areas        | ✅       | `Array<string>` | An array of grid-template-areas with each entry corresponding to a row                                                                                                                                                                              |
| areasXl      | ❌       | `Array<string>` | An array of grid-template-areas which display above 1200px                                                                                                                                                                                          |
| areasLg      | ❌       | `Array<string>` | An array of grid-template-areas to display up to 1200px                                                                                                                                                                                             |
| areasMd      | ❌       | `Array<string>` | An array of grid-template-areas up to 992px                                                                                                                                                                                                         |
| areasSm      | ❌       | `Array<string>` | An array of grid-template-areas up to 768px                                                                                                                                                                                                         |
| areasXs      | ❌       | `Array<string>` | An array of grid-template-areas up to 576px                                                                                                                                                                                                         |
| columns      | ❌       | `Array<string>` | An array of grid-template-columns with each entry corresponding to a column. Can accept a number (N) which as a column which will result in `minmax(0, Nfr)`. If a string is provided the string will be directly applied with nothing added to it. |
| columnsXl    | ❌       | `Array<string>` | An array of grid-template-columns which display above 1200px                                                                                                                                                                                        |
| columnsLg    | ❌       | `Array<string>` | An array of grid-template-columns to display up to 1200px                                                                                                                                                                                           |
| columnsMd    | ❌       | `Array<string>` | An array of grid-template-columns up to 992px                                                                                                                                                                                                       |
| columnsSm    | ❌       | `Array<string>` | An array of grid-template-columns up to 768px                                                                                                                                                                                                       |
| columnsXs    | ❌       | `Array<string>` | An array of grid-template-columns up to 576px                                                                                                                                                                                                       |
| rows         | ❌       | `Array<string>` | An array of grid-template-rows with each entry corresponding to a row                                                                                                                                                                               |
| rowsXl       | ❌       | `Array<string>` | An array of grid-template-rows which display above 1200px                                                                                                                                                                                           |
| rowsLg       | ❌       | `Array<string>` | An array of grid-template-rows to display up to 1200px                                                                                                                                                                                              |
| rowsMd       | ❌       | `Array<string>` | An array of grid-template-rows up to 992px                                                                                                                                                                                                          |
| rowsSm       | ❌       | `Array<string>` | An array of grid-template-rows up to 768px                                                                                                                                                                                                          |
| rowsXs       | ❌       | `Array<string>` | An array of grid-template-rows up to 576px                                                                                                                                                                                                          |
| justify      | ❌       | `string`        | Passes in a [justify-content](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) setting                                                                                                                                             |
| justifyItems | ❌       | `string`        | Passes in a [justify-items](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items) setting                                                                                                                                                 |
| align        | ❌       | `string`        | Passes in a [align-items](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items) setting                                                                                                                                                     |
| place        | ❌       | `string`        | Passes in a [place-items](https://developer.mozilla.org/en-US/docs/Web/CSS/place-items) setting                                                                                                                                                     |
| className    | ❌       | `string`        | A string of the className to be applied to the Grid component                                                                                                                                                                                       |
| children     | ✅       | `JSX.Element`   |                                                                                                                                                                                                                                                     |

## Layout.Section

`Layout.Section` is the dynamic child of a `Layout.Grid`.

#### API

| Prop | Required | Type | Description |
| ---- | -------- | ---- | ----------- |

| children | ✅ | `JSX.Element` |

| area | ✅ | `string` | The grid-template area to which this section belongs |

| ref | ❌ | `React.Ref<HTMLDivElement>` | Optional [ref](https://reactjs.org/docs/refs-and-the-dom.html) for targeting the underlying HTML element |

---
_Source: https://npm.io/package/@wedgekit/layout · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
