Skip to content

Instantly share code, notes, and snippets.

Storybook Docs w/ CRA & TypeScript

This is a quick-and-dirty walkthrough to set up a fresh project with Storybook Docs, Create React App, and TypeScript. If you're looking for a tutorial, please see Design Systems for Developers, which goes into much more depth but does not use Typescript.

The purpose of this walkthrough is a streamlined Typescript / Docs setup that works out of the box, since there are countless permutations and variables which can influence docs features, such as source code display, docgen, and props tables.

Step 1: Initialize CRA w/ TS

npx create-react-app cra-ts --template typescript
<template>
<nav id="pagination">
<ul class="page-numbers" v-if="$store.state.totalPageCount">
<li v-for="num in this.pageNumbers" v-if="num != null" v-bind:style="{ width: (100 / pageNumberCount) + '%' }">
<nuxt-link v-if="num != $route.query.page && num != currentPage" :to="{ path: '/', query: { page: num } }">{{ num }}</nuxt-link>
<span v-else>{{ num }}</span>
</li>
</ul>
<ul class="page-guides" v-if="this.$store.state.totalPageCount != 1">
<li>
@dyarfi
dyarfi / finalImplementations.md
Created June 11, 2020 07:25 — forked from PercyPham/finalImplementations.md
Implementing Json Web Token (JWT) to secure your app
@dyarfi
dyarfi / default
Created March 29, 2020 17:42 — forked from miguelmota/default
Nginx + Node.js server configuration. Blog post: http://www.miguelmota.com/blog/nodejs-and-ngnix-on-ubuntu/
# The upstream module is the link between Node.js and Nginx.
# Upstream is used for proxying requests to other servers.
# All requests for / get distributed between any of the servers listed.
upstream helloworld {
# Set up multiple Node.js webservers for load balancing.
# max_fails refers to number of failed attempts
# before server is considered inactive.
# weight priorities traffic to server. Ex. weight=2 will recieve
# twice as much traffic as server with weight=1
server <your server ip>:3000 max_fails=0 fail_timeout=10s weight=1;
@dyarfi
dyarfi / docker-help.md
Created December 4, 2018 06:16 — forked from bradtraversy/docker-help.md
Docker Commands, Help & Tips

Docker Commands, Help & Tips

Show commands & management commands

$ docker

Docker version info

@dyarfi
dyarfi / bootstrap-4-sass-mixins-cheat-sheet.scss
Created March 12, 2018 09:29
Bootstrap 4 Sass Mixins [Cheat sheet with examples]
/* -------------------------------------------------------------------------- */
// All Bootstrap 4 Sass Mixins [Cheat sheet]
// @author http://anschaef.de
// @see https://github.com/twbs/bootstrap/tree/v4-dev/scss/mixins
/* -------------------------------------------------------------------------- */
// Grid variables
$grid-columns: 12 !default;
$grid-gutter-width: 30px !default;