Giter Club home page Giter Club logo

simple-drawer-sidebar's Introduction

Instruction

Make sure the css file is imported properly.

import sidebarStyle from "../whereever/thefile.css

The css file is already imported by default. If you change the relative location of the css file, make sure to change the import as well.

Then simply import and integrate into any React component.

 <>
    <Sidebar backgroundColor="white" mainElemsTag="h1" />
    <EnlargedImage />
    <Flex justify="center">
      <GridContainer width="100%" height="100%" maxWidth="2000px">
        <Box className="markdown" gridColumn="content-begin / content-end">
          {children}
        </Box>
      </GridContainer>
    </Flex>
  </>

The component is a fixed-position component, so place it anywhere as long as it doesn't disrupt the siblings flow in components like the ones with lobotomized-owl selector or flex components.

There are 4 props you can pass, but only 3 at once. You can choose to either have the Sidebar populate its items by looking up the class or the tag.

Here's the type:

type SidebarProps = {
  backgroundColor?: string;
  /**
   * Defaults to 1000
   */
  zIndex?: number;
} & (
  | {
      mainElemsTag: string;
      mainElemsClass?: never;
    }
  | {
      mainElemsTag?: never;
      mainElemsClass: string;
    }
);

Example: https://www.khong.xyz/blog (the bar on the right)

simple-drawer-sidebar's People

Contributors

khongchai avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.