summaryrefslogtreecommitdiffstats
path: root/uidev/src/app.tsx
blob: a1c9ee34334a7d4de623757a4da0227ba92ce189 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import { Classes } from 'jss';
import React, { Component } from 'react';
import { render } from 'react-dom';
import injectSheet from 'react-jss';
import './stories/input';
import { WithTheme } from './withTheme';

import { store } from './stores';

const styles = {
  container: {
    display: 'flex',
    width: '100%',
  },
  menu: {
    width: 300,
    position: 'fixed' as any,
  },
  stories: {
    width: '100%',
    marginLeft: 320,
    paddingLeft: 40,
    paddingRight: 40,
    borderLeft: '1px solid #CFCFCF',
  },
  sectionHeadline: {
    fontSize: 30,
  },
  storyHeadline: {
    fontSize: 24,
  },
  story: {
    paddingBottom: 40,
    marginBottom: 40,
    borderBottom: '1px solid #CFCFCF',
  },
};

const foo = {
  seas: 'bar',
};

export const App = injectSheet(styles)(({ classes }: { classes: Classes }) => (
  <div className={classes.container}>
    <ul className={classes.menu}>
      {store.stories.sections.map((section, key) => (
        <li key={key}>
          <a href={`#section-${key}`}>{
            section.name}
          </a>
          <ul>
            {section.stories.map((story, storyKey) => (
              <li key={storyKey}>
                <a href={`#section-${key}-story-${storyKey}`}>
                  {story.name}
                </a>
              </li>
            ))}
          </ul>
        </li>
      ))}
    </ul>
    <div className={classes.stories}>
      {store.stories.sections.map((section, key) => (
        <div key={key}>
          <h1
            id={`section-${key}`}
            className={classes.sectionHeadline}
          >
            {section.name}
          </h1>
          {section.stories.map((story, storyKey) => (
            <div className={classes.story} key={storyKey}>
              <h2
                id={`section-${key}-story-${storyKey}`}
                className={classes.storyHeadline}
              >
                {story.name}
              </h2>
              <WithTheme>
                {story.component()}
              </WithTheme>
            </div>
          ))}
        </div>
      ))}
    </div>
  </div>
));