Giter Club home page Giter Club logo

bookit's Introduction

๐Ÿ‘ป Bookit ๐Ÿ‘ป

Demo Docs (coming soon)

The least spooky way to build your components.

Pronounced Boo-Kit or Book-It

A new Story environment with a different approach. Finely tuned to work directly within your Svelte Kit projects. Stay tuned for more information and docs on how to use and add to your projects.

Why it's dope

  • Easy
  • Build for Svelte Kit
  • No webpack, or extra build process
  • Integrated into your app
  • Themeable
  • Use your real data
  • Simple

Setting up your project

You'll need to create this route structure

  1. First step is to create this new route structure

    src/routes/
    โ”œโ”€ +layout.svelte
    โ”œโ”€ ...                  // other routes
    +โ””โ”€ (book)/
    +    โ”œโ”€ +layout.svelte  
    +    โ”œโ”€ +layout.ts
    +    โ””โ”€ book/
    +        โ””โ”€ [parent]-[title]/
    +            โ”œโ”€ +page.svelte
    +            โ””โ”€ +page.ts
    • In src/routes/(book)/+layout.svelte

      <script lang="ts">
          import { Book } from '@leveluptuts/bookit';
          import '../../../src/app.css'; // your app's css
      </script>
      
      <Book>
          <slot />
      </Book>
    • In src/routes/(book)/+layout.svelte

      export { layoutLoad as load } from '@leveluptuts/bookit';
    • In src/routes/(book)/book/[parent][title]/+page.svelte

      <script lang="ts">
          import { Bookit } from '@leveluptuts/bookit';
          type Data = {
              props: {
                  params: {
                      parent: string;
                      title: string;
                  };
              };
          };
          export let data: Data;
      </script>
      
      <Bookit params={data.props.params} />
    • In src/routes/(book)/book/[parent]-[title]/+page.ts

      export { load } from '@leveluptuts/bookit';
  2. Now your project is set up, let's now create our first story file that has a name like this MyButton.story.svelte

  3. Import and wrap your component with Canvas and Frame

    <script context="module" lang="ts">
        import { Canvas, Frame } from '@leveluptuts/bookit';
        import MyButton from './MyButton.svelte';
    
        export const parent = 'Library';
        export const title = 'Button';
    </script>
    
    <Canvas>
        <Frame title="Primary">
            <MyButton color="blue" />
        </Frame>
    </Canvas>
  4. To view the story in the browser, navigate to /book/Library-Button.

Note: Both variables in the story parent and title are used for the paramterized route in /book/[parent]-[title]

bookit's People

Contributors

stolinski avatar ahnwarez avatar mgielda 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.