Skip to content
This repository has been archived by the owner on May 14, 2020. It is now read-only.

Add theme #5

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules/
12 changes: 12 additions & 0 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {addParameters, configure} from '@storybook/html';
import theme from './theme';

const context = require.context('../src', true, /\.stories\.js$/);

addParameters({
options: {
theme: theme,
},
});

configure(context, module);
22 changes: 22 additions & 0 deletions .storybook/theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {create} from '@storybook/theming'

export default create({
base: 'light',
brandTitle: 'Libero Publisher',
brandUrl: 'https://libero.pub/',
colorPrimary: 'rgb(2, 136, 209)',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done an experiment locally, and reasonably straightforward to get this values from Sass using Webpack.

colorSecondary: 'rgb(2, 119, 189)',
appBg: 'rgb(255, 255, 255)',
appContentBg: 'rgb(255, 255, 255)',
appBorderColor: 'rgb(224, 224, 224)',
appBorderRadius: 4,
textColor: 'rgb(33, 33, 33)',
textInverseColor: 'rgb(255, 255, 255)',
barTextColor: 'rgb(136, 136, 136)',
barSelectedColor: 'rgb(33, 33, 33)',
barBg: 'rgb(179, 229, 252)',
inputBg: 'rgb(255, 255, 255)',
inputBorder: 'rgb(2, 119, 189)',
inputTextColor: 'rgb(255, 255, 255)',
inputBorderRadius: 4,
})
11 changes: 10 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
language: minimal

dist: bionic

services: docker

install:
- make build

script:
- 'true'
- make start
- make logs
- make stop
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM node:10.16.3-alpine AS node
WORKDIR /app



#
# Stage: NPM install
#
FROM node AS npm

COPY package.json \
package-lock.json \
./

RUN npm install



#
# Stage: Storybook environment
#
FROM node AS storybook

COPY --from=npm /app/ .
COPY .storybook/ .storybook/
COPY src/ src/



#
# Stage: Development environment
#
FROM storybook AS dev
ENV NODE_ENV=development
EXPOSE 8080

CMD ["npx", "start-storybook", "--port", "8080"]

HEALTHCHECK --interval=30s --timeout=1s \
CMD wget --quiet --tries=1 --spider http://localhost:8080/ || exit 1
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.DEFAULT_GOAL = help

DEV = docker-compose --file docker-compose.dev.yml

help: ## Display this help text
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

install: ## Install dependencies locally
npm install

build: ## Build the container
${DEV} build --pull

start: build ## Start the container
${DEV} up --detach

exec: ## Execute a command on the container
${DEV} exec app $(cmd)

sh: ## Open a shell on the container
${DEV} exec app sh

logs: ## Show the container's log
${DEV} logs

watch: ## Follow the container's log
${DEV} logs --follow

stop: ## Stop the container
${DEV} down --volumes --remove-orphans
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,42 @@ Libero Storybook

[![Build Status](https://travis-ci.com/libero/storybook.svg?branch=master)](https://travis-ci.com/libero/storybook)

Requirements
------------

- [Docker](https://www.docker.com/)
- [GNU Make](https://www.gnu.org/software/make/)
- [Node.js](https://nodejs.org/) (for development)

Developing
----------

To install dependencies locally, execute:

```shell
make install
```

To run Storybook, execute:

```shell
make start
```

Then open http://localhost:8080/ in your browser.

To follow the container's log, execute:

```shell
make watch
```

To stop the container, execute:

```shell
make stop
```

Getting help
------------

Expand Down
11 changes: 11 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3.4'

services:
app:
build:
context: .
target: dev
ports:
- 8080:8080
volumes:
- ./src/:/app/src:ro
Loading