3.2.0 • Published 4 years ago

@crystallize/react-layout v3.2.0

Weekly downloads
148
License
MIT
Repository
github
Last release
4 years ago

alt text

react-layout

Helpers for setting up main layout with side menus. React components for building Crystallize (GraphQL based PIM) powered React commerce with SSR using Next.js.

Install

yarn add @crystallize/react-layout

Usage

import CrystallizeLayout, { LayoutContext } from '@crystallize/react-layout';

<CrystallizeLayout left={LeftComponent} right={RightComponent}>
    <main>
        <LayoutContext.Consumer>
            {({ state, actions }) => (
                <div>
                    <div>Left shown? {state.leftShown ? 'yes' : 'no'}</div>
                    <div>
                        Right shown? {state.rightShown ? 'yes' : 'no'}
                    </div>
                    <div>Content pushed: {state.contentPushed}</div>
                    <button onClick={actions.showLeft}>Show left menu</button>
                    <button onClick={actions.showRight}>Show right menu</button>
                </div>
            )}
        </LayoutContext.Consumer>
    </main>
</CrystallizeLayout>

Exports

  • (default) CrystallizeLayout
  • LayoutContext
    • actions
      • showLeft
      • showRight
      • hideLeft
      • hideRight
      • hideBoth
      • toggleLeft
      • toggleRight
    • state
      • leftShown
      • rightShown
      • contentPushed

Component props

  • left
  • right
  • leftWidth
  • rightWidth
  • width (for both left and right)
  • transitionProp ('left/right' or 'transform')

contentPushed (string)

Reflects the current offset the content has been pushed. Is by default

  • 300px (left menu is shown)
  • 0px (no menu is shown)
  • -300px (right menu is shown)
3.2.0

4 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.0

6 years ago

1.10.1

6 years ago

1.10.0

6 years ago

1.9.0

6 years ago

1.8.0

6 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.5.4

6 years ago

1.5.3

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.4

6 years ago

1.4.3

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago