4.1.9 • Published 2 years ago

bpk-component-drawer-css v4.1.9

Weekly downloads
209
License
Apache-2.0
Repository
github
Last release
2 years ago

bpk-component-drawer

Backpack drawer component.

Installation

npm install bpk-component-drawer --save-dev

Usage

import React, { Component } from 'react';
import BpkDrawer from 'bpk-component-drawer';
import BpkButton from 'bpk-component-button';

class App extends Component {
  constructor() {
    super();

    this.state = {
      isOpen: false,
    };
  }

  onOpen = () => {
    this.setState({
      isOpen: true,
    });
  };

  onClose = () => {
    this.setState({
      isOpen: false,
    });
  };

  render() {
    return (
      <div>
        <div id="pagewrap">
          <BpkButton onClick={this.onOpen}>Open drawer</BpkButton>
        </div>
        <BpkDrawer
          id="my-drawer"
          isOpen={this.state.isOpen}
          onClose={this.onClose}
          title="Drawer title"
          closeLabel="Close drawer"
          getApplicationElement={() => document.getElementById('pagewrap')}
        >
          This is a drawer. You can put anything you want in here.
        </BpkDrawer>
      </div>
    );
  }
}

Note: In order to "hide" your application from screen readers whilst the drawer is open you need to let it know what the root element for your application is by returning it's DOM node via the function passed to the getApplicationElement prop (see the example above). The pagewrap element id is a convention we use internally at Skyscanner. In most cases it should "just work".

Theming: In order to theme the drawer, a renderTarget needs to be supplied as a function which returns a DOM node in the scope of a BpkThemeProvider.

Props

PropertyPropTypeRequiredDefault Value
idstringtrue-
classNamestringtrue-
contentClassNamestringtrue-
childrennodetrue-
isOpenbooltrue-
onClosefunctrue-
titlestringtrue-
getApplicationElementfunctrue-
closeLabelstringfalsenull
closeTextstringfalsenull
hideTitleboolfalsefalse
renderTargetfuncfalsenull

Theme Props

  • linkColor
  • linkHoverColor
  • linkActiveColor
  • linkVisitedColor
4.1.9

2 years ago

4.1.7

2 years ago

4.1.5

2 years ago

4.1.4

2 years ago

4.1.2

2 years ago

4.1.1

2 years ago

4.0.21

2 years ago

4.0.20

2 years ago

4.0.29

2 years ago

4.0.23

2 years ago

4.0.30

2 years ago

4.0.32

2 years ago

4.0.35

2 years ago

4.0.19

3 years ago

4.0.14

3 years ago

4.0.11

3 years ago

4.0.9

3 years ago

4.0.8

3 years ago

4.0.7

3 years ago

4.0.6

3 years ago

4.0.5

3 years ago

4.0.4

3 years ago

4.0.3

3 years ago

4.0.2

3 years ago

4.0.1

3 years ago

3.1.8

3 years ago

4.0.0

3 years ago

3.1.6

3 years ago

3.1.5

3 years ago

3.1.4

3 years ago

3.1.3

3 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.81

3 years ago

3.0.82

3 years ago

3.0.80

3 years ago

3.0.79

3 years ago

3.0.78

3 years ago

3.0.76

3 years ago

3.0.77

3 years ago

3.0.75

3 years ago

3.0.74

3 years ago

3.0.73

3 years ago

3.0.71

3 years ago

3.0.72

3 years ago

3.0.70

3 years ago

3.0.69

3 years ago

3.0.68

3 years ago

3.0.67

3 years ago

3.0.66

3 years ago

3.0.65

3 years ago

3.0.64

3 years ago

3.0.63

3 years ago

3.0.62

3 years ago

3.0.61

3 years ago

3.0.60

3 years ago

3.0.59

3 years ago

3.0.58

3 years ago

3.0.57

3 years ago

3.0.56

3 years ago

3.0.54

3 years ago

3.0.55

3 years ago

3.0.52

3 years ago

3.0.53

3 years ago

3.0.49

3 years ago

3.0.48

4 years ago

3.0.47

4 years ago

3.0.46

4 years ago

3.0.45

4 years ago

3.0.43

4 years ago

3.0.42

4 years ago

3.0.41

4 years ago

3.0.40

4 years ago

3.0.39

4 years ago

3.0.38

4 years ago

3.0.36

4 years ago

3.0.35

4 years ago

3.0.34

4 years ago

3.0.29

4 years ago

3.0.26

4 years ago

3.0.24

4 years ago

3.0.23

4 years ago

3.0.22

4 years ago

3.0.21

4 years ago