4.1.1 • Published 4 years ago

omtv-theme v4.1.1

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

Theme for react app.

Check theme demo.

Install

npm i omtv-theme

Use

import React from 'react';
import ReactDOM from 'react-dom';

import {
  GlobalStyle, Button, A,
  H1, H2, H3, H4, H5, H6,
} from 'omtv-theme';
import {
  Article, Code, Header, Component, Comment,
} from 'omtv-theme/theme/demoArticle';

const App = () => (
  <>
    <GlobalStyle />
    <H1>App header</H1>
    <H2>header2</H2>
    <H3>header3</H3>
    <H4>header4</H4>
    <H5>header5</H5>
    <H5>header6</H6>
    <Article>
      <Header bookmark='article1'>Article header</Header>
      <Component>
        A <A href='#article1'>link</A> example and a <Button>
          button
        </Button> example
      </Component>
      <Code>{ `
import React, { useState } from 'react';
import SomeComponent from 'some-component';

export const = () => {
  const [{ value }, setValue] = useState({ value: '' });

  return (
    <div>
      <input value={ value } onChange={ e => setValue(e.targe.value) } />
    </div>
  );
};
      ` }</Code>
      <Comment>
        Comment for the article
      </Comment>
    </Article>
  </>
);

export default App;

Theme is not bundled or compiled, It is provided in raw form as is (see theme/ folder). The project that is going to use this theme should bundle and complie theme itself, here are the instructions for webpack and babel:

module.exports = {
  ...
  module: {
    rules: [
      {
        test: /\.js$/,
        include: [
          path.resolve(__dirname, 'src'),
          path.resolve(__dirname, 'node_modules/my-component'),
        ],
        use: {
          loader: 'babel-loader',
          options: {
            ...
          },
        },
      },
    ],
  },
  ...
};

You can also use omtv-template-react for your project, it's webpack/babel config is compatible with this approach.

Static type checking

Theme contains Flow Comment Types that allows either to use flow static typechecking or simply ignore it.

Improve

  1. Install dependencies npm i.
  2. Start webpack dev server for demo project npm run demo.
  3. (optional) Start jest in watch mode npm run jest.
  4. Improve component.
  5. (optional) Publish component demo: npm run publish-demo will try to publish demo create scripts/secret.js file
      module.exports = {
        pwd: '', // leave this field empty if you want script to prompt for password
        host: 'your.host.com', // default port 22, specify other port: 'your.host:222'
      };
    Scripts/secret.js is added to gitignore.
4.1.1

4 years ago

4.1.0

4 years ago

4.0.3

4 years ago

4.0.2

4 years ago

4.0.1

4 years ago

4.0.0

4 years ago

3.0.1

5 years ago

3.0.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.0

5 years ago

0.0.15

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago

0.0.0

5 years ago