npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-just-a-book

v1.0.4

Published

React component stylized to look and function like a real life book!

Downloads

3

Readme

JUST'A'BOOK

Key features:

  • React Webpage stylized to look and function like a book.
  • Pages are actual 3D objects, turning and displaying content on both of their sides.
  • Pages (and pagination) are created programmaticaly by the application by suppling pages' content into an array.

Usage

I. START

Simply import and include JustABook component in your application. You can customize your book by passing in props specified in section below.

If you're using the book as a main body of your website, I recommend applying the following styles to the container holding 'JustABook' element (or the ".body" element):

     {
        height: 100dvh;
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
     }

II. FUNCTIONALITY

a. content - An array. Place the content of your pages here in the following format:

     [
        [Page1FrontComponent, Page1BackComponent], 
        [Page2FrontComponent, Page2BackComponent],
        [Page3FrontComponent, Page3BackComponent],
        [PageXFrontComponent, PageXBackComponent]
     ]
              

Element at position [0] of the array will become the front side of the page. Element at position [1] of the array will render on the back of the page. I recommend placing content as react components.

disableScrollandModal

If "true", Flipping pages using mouse wheel scroll, as well as modal component, will be disabled. Usefull if you want to embed the book as a component of another website. False by default.

windowScroll

If "true", Mousewheel scrolling event will be attached to the entire window, firing irregardles of the cursor position. If "false", Mouse scrolling event will be attached to the book element, firing only when pointer hovers it. False by default.

disablePortrait

If "true", the book will disappear once devices' screen orientation changes to portrait. Message prompting user to rotate their screens will pop up instead. I recommed keeping this option. True by default.

rotateMessage

Content to be displayed once screen orientation changes to portrait. If no content is passed, default message will be displayed, with default styling.

III. STYLING

Following styles will be applied to the components as inline styles, and should be written as such.

coverOuterStyle

This changes the style of the padding arround the book, imitating it's outer cover.

coverInnerStyle

This changes the style of the two elements imitating inner side of the book's cover. Those elements are visible with first and last page of the book.

WARNING. Height and with of those elements determine the dimentions of the whole book and are displayed side by side. Divide specified width by 2 to achieve desired width of the book.

pageFrontStyle, pageBackStyle

This changes the style of the actual page sides. WARNING. Avoid using the "transform" property.

paginationStyle

This changes the style of paragraph displaying page number.

leftButton, rightButton

Custom icons (or element) to be displayed as the left or right pagination button. If unspecified, default SVG arrows will be displayed with default animations. Default arrows share take their colors with the font. Those elements will be placed inside button HTML element.

III. Context

Following variables and functions are provided as context, accessible everywhere within the book:

setModalContent

useState set function. Components passed into the function will be displayed in a modal.

setShowModal

useState set function. Pass in the boolean "true" variable to hide the book and display the modal. Passing in "false" boolean will do the opposite. Use this to display/hide modal.