2.2.0 • Published 1 year ago

@wedgekit/layout v2.2.0

Weekly downloads
232
License
MIT
Repository
-
Last release
1 year ago

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

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

PropRequiredTypeDefaultDescription
headerJSX.ElementnullAn application header designed to be placed at the top of the app
notificationsJSX.ElementnullNotifications/Alerts components to be rendered below the header and above the rest of the content.
resourceJSX.ElementA resource to be rendered when resourceMounted is true
resourceMountedbooleanfalseWhether 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.
drawerLeftbooleanfalseWhen true show the drawer on the left side of the screen
drawerWidthstringCustom 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

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

PropRequiredTypeDescription
areasArray<string>An array of grid-template-areas with each entry corresponding to a row
areasXlArray<string>An array of grid-template-areas which display above 1200px
areasLgArray<string>An array of grid-template-areas to display up to 1200px
areasMdArray<string>An array of grid-template-areas up to 992px
areasSmArray<string>An array of grid-template-areas up to 768px
areasXsArray<string>An array of grid-template-areas up to 576px
columnsArray<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.
columnsXlArray<string>An array of grid-template-columns which display above 1200px
columnsLgArray<string>An array of grid-template-columns to display up to 1200px
columnsMdArray<string>An array of grid-template-columns up to 992px
columnsSmArray<string>An array of grid-template-columns up to 768px
columnsXsArray<string>An array of grid-template-columns up to 576px
rowsArray<string>An array of grid-template-rows with each entry corresponding to a row
rowsXlArray<string>An array of grid-template-rows which display above 1200px
rowsLgArray<string>An array of grid-template-rows to display up to 1200px
rowsMdArray<string>An array of grid-template-rows up to 992px
rowsSmArray<string>An array of grid-template-rows up to 768px
rowsXsArray<string>An array of grid-template-rows up to 576px
justifystringPasses in a justify-content setting
justifyItemsstringPasses in a justify-items setting
alignstringPasses in a align-items setting
placestringPasses in a place-items setting
classNamestringA string of the className to be applied to the Grid component
childrenJSX.Element

Layout.Section

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

API

PropRequiredTypeDescription

| children | ✅ | JSX.Element |

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

| ref | ❌ | React.Ref<HTMLDivElement> | Optional ref for targeting the underlying HTML element |

2.2.0

1 year ago

2.0.1

2 years ago

2.0.0

2 years ago

2.1.2-tc.0

2 years ago

2.0.2-tc.0

2 years ago

2.0.2-tc.1

2 years ago

2.1.2-tc.1

2 years ago

2.1.2-tc.4

2 years ago

2.0.2-tc.4

2 years ago

2.1.2-tc.3

2 years ago

2.0.2-tc.5

2 years ago

2.1.2-tc.6

2 years ago

2.0.2-tc.2

2 years ago

2.1.2-tc.5

2 years ago

2.0.2-tc.3

2 years ago

2.1.2-tc.8

2 years ago

2.0.2-tc.8

2 years ago

2.1.2-tc.7

2 years ago

2.0.2-tc.9

2 years ago

2.0.2-tc.6

2 years ago

2.1.2-tc.9

2 years ago

2.0.2-tc.7

2 years ago

2.1.3-tc.10

1 year ago

2.0.1-tc.0

2 years ago

2.1.3-tc.0

1 year ago

2.1.3-tc.1

1 year ago

2.1.3-tc.2

1 year ago

2.1.2-tc.11

2 years ago

2.1.2-tc.10

2 years ago

2.1.2-tc.13

2 years ago

2.1.2-tc.12

2 years ago

2.1.2-tc.15

2 years ago

2.1.2-tc.14

2 years ago

2.1.2-tc.17

2 years ago

2.1.2-tc.16

2 years ago

2.1.2-tc.18

2 years ago

2.0.2-tc.14

2 years ago

2.0.2-tc.13

2 years ago

2.0.2-tc.16

2 years ago

2.0.2-tc.15

2 years ago

2.0.2-tc.10

2 years ago

2.0.2-tc.12

2 years ago

2.0.2-tc.11

2 years ago

2.1.1-tc.1

2 years ago

2.1.1-tc.0

2 years ago

2.1.1-tc.7

2 years ago

2.1.1-tc.6

2 years ago

2.1.1-tc.9

2 years ago

2.1.1-tc.8

2 years ago

2.1.1-tc.3

2 years ago

2.1.1-tc.2

2 years ago

2.1.1-tc.5

2 years ago

2.1.1-tc.4

2 years ago

2.1.1-tc.11

2 years ago

2.1.1-tc.10

2 years ago

2.1.2

1 year ago

2.1.1

2 years ago

2.1.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.2-tc.1

2 years ago

1.0.1-tc.0

2 years ago

1.0.1-tc.1

2 years ago

0.4.10-tc.0

3 years ago

0.5.0

3 years ago

0.4.9

3 years ago

0.4.10

3 years ago

0.4.9-tc-0

3 years ago

0.4.9-tc.5

3 years ago

0.4.9-tc.3

3 years ago

0.4.9-tc.4

3 years ago

0.4.9-tc.1

3 years ago

0.4.9-tc.2

3 years ago

0.4.9-tc.0

3 years ago

0.4.8

3 years ago

0.4.7

3 years ago

0.4.7-tc.4

3 years ago

0.4.7-tc.5

3 years ago

0.4.7-tc.6

3 years ago

0.4.7-tc.7

3 years ago

0.4.7-tc.1

3 years ago

0.4.7-tc.2

3 years ago

0.4.7-tc.3

3 years ago

0.4.7-tc.0

3 years ago

0.4.6

3 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.4-tc.0

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.15

5 years ago

0.3.14

5 years ago

0.3.13

5 years ago

0.3.12

5 years ago

0.3.12-tc.1

5 years ago

0.3.12-tc.0

5 years ago

0.3.11

5 years ago

0.3.11-tc.0

5 years ago

0.3.10

5 years ago

0.3.9

5 years ago

0.3.8

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago