All Projects β†’ SilentCicero β†’ hyperapp-styled-components

SilentCicero / hyperapp-styled-components

Licence: MIT license
styled-components for hyperapp in under 3kb

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to hyperapp-styled-components

gumdrops
GumGum's React Reusable Component Library
Stars: ✭ 56 (+229.41%)
Mutual labels:  components
lookbook
A tool to help browse, develop, test & document ViewComponents in Ruby on Rails apps πŸ› 
Stars: ✭ 420 (+2370.59%)
Mutual labels:  components
postcss-styled
PostCSS syntax for parsing styled components
Stars: ✭ 53 (+211.76%)
Mutual labels:  styled
storybook-talk
Storybook, the playground you need for your UI components! 🎨
Stars: ✭ 11 (-35.29%)
Mutual labels:  components
craft-helper
A collection of useful Craft CMS macros and components.
Stars: ✭ 23 (+35.29%)
Mutual labels:  components
vue-mui
Mobile UI elements for Vue 2.0
Stars: ✭ 16 (-5.88%)
Mutual labels:  components
blockml-component
A component-based virtual DOM system (similar to React) for blockml.
Stars: ✭ 23 (+35.29%)
Mutual labels:  components
v-svg-icons
Svg icons for VueJS.
Stars: ✭ 36 (+111.76%)
Mutual labels:  components
Public
The game is about a group of "terrorists" who have traitors among them, out to kill everyone who's not a traitor.
Stars: ✭ 94 (+452.94%)
Mutual labels:  in
torchx
TorchX is a universal job launcher for PyTorch applications. TorchX is designed to have fast iteration time for training/research and support for E2E production ML pipelines when you're ready.
Stars: ✭ 165 (+870.59%)
Mutual labels:  components
NE-Component
A react component library.
Stars: ✭ 29 (+70.59%)
Mutual labels:  components
commix
Micro-framework for data-driven composable system architectures
Stars: ✭ 46 (+170.59%)
Mutual labels:  components
ionic3-start-theme
Ionic 3 Start Theme with 10 Pages, mock data, providers samples, Storage, Http and more...
Stars: ✭ 130 (+664.71%)
Mutual labels:  components
react-parallax-card
[wip] React component for a 3D card with parallax effects similar to Apple TV app icons.
Stars: ✭ 21 (+23.53%)
Mutual labels:  components
tsstyled
A small, fast, and simple CSS-in-JS solution for React.
Stars: ✭ 52 (+205.88%)
Mutual labels:  components
ng-vcl
Angular VCL β€’ an Angular component library based on the VCL CSS eco system
Stars: ✭ 17 (+0%)
Mutual labels:  components
vue-patternfly
PatternFly 3 components for Vue 3
Stars: ✭ 50 (+194.12%)
Mutual labels:  components
design-system
The Baloise Design System consists of reusable components and a clearly defined visual style, that can be assembled together to build any number of applications.
Stars: ✭ 40 (+135.29%)
Mutual labels:  components
vortex-components
βš›οΈVortex Components is a collection of React Components that helps developers build Ethereum Dapps powered by the Vortex Redux Store.
Stars: ✭ 14 (-17.65%)
Mutual labels:  components
hsx
Static HTML sites with JSX and webpack (no React).
Stars: ✭ 15 (-11.76%)
Mutual labels:  components

hyperapp-styled-components


A super tiny Hyperapp equivalent of styled-components.

Install

npm install --save hyperapp-styled-components

Usage

First add this to your HTML file in the tag: <style type="text/css" id="styles"></style> than..

import { h, app } from "hyperapp";
import styled from 'hyperapp-styled-components';

const Header = styled.h2`
  color: #333;
`;

const MyButton = styled.button`
  padding: 10px;
  border-radius: ${0}px;
  background: #F1F1F1;

  &:hover {
    background: ${props => props.color};
  }
`;

const Wrapper = styled.div`
  width: 500px;
  border: 1px solid #aaa;

  @media (min-width: 400px) {
    width: 100%;
    background: #F1F1F1;
  }
`;

app({
  init: 0,
  view: state => (
    <Wrapper>
      <Header>Welcome to Styled Hyperapp {state ? 'Yay!' : ''}</Header>

      <MyButton onclick={state => 1}>Go</MyButton>
    </Wrapper>
  ),
  node: document.getElementById("app")
});

Features

  • Super tiny 2.1kb gzipped
  • Completely DOM based
  • Supports @media
  • Supports @keyframes (via keyframes method)
  • Supports pseudo CSS (i.e. &:hover)
  • State can be fed in through primitive methods (i.e props => ...)
  • No dependencies
  • Uses template literals and real CSS
  • Supports all DOM elements
  • Auto CSS class injection/management
  • Works with hyperapp

About

I love styled-components and needed a HyperApp equivalent for a project. This is the result. It functions almost the same with pseudo and media queries supported. Dynamic props can be fed in through primitive functions; the output of each is a function where props can be fed in, which then returns another function where child elements and strings can be fed in.

A special thanks to Max Stoiber and the styled-components team for coming up with a great component API for mixing CSS and JS.

Usage with Props

import styled from 'hyperapp-styled-components';

const Header = styled.h2`
  color: #${props => props.status === 'success' ? '000' : '333'};
`;

const View = () => () => (
  <div>
    <Header status="success"></Header>
  </div>
);

With Keyframes

import styled, { keyframes } from 'hyperapp-styled-components';

const boxmove = keyframes`
  0%   {top: 0px;}
  25%  {top: 200px;}
  75%  {top: 50px}
  100% {top: 100px;}
`;

const Box = styled.div`
  background-color: lightcoral;
  width: 100px;
  height: 100px;
  display: block;
  position :relative;
  animation: ${boxmove} 5s infinite;
`;

Important documents

Todo

  • Testing
  • Coverage
  • Documentation

Licence

This project is licensed under the MIT license, Copyright (c) 2016 Nick Dodson. For more information see LICENSE.md.

The MIT License

Copyright (c) 2016 Nick Dodson. nickdodson.com <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].