Git Product home page Git Product logo

wix-style-react's Introduction

wix-style-react is a collection of React components that conform to Wix Style created by Wix UX guild.

Installation

  • Install with npm or yarn:
npm i wix-style-react
# OR
yarn add wix-style-react

Usage

Requirements

  • Load Wix fonts from CDN
    <link rel="stylesheet" href="//static.parastorage.com/services/third-party/fonts/Helvetica/fontFace.css">
  • Enable font smoothing with browser specific css properties, for example:
    html {
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
    }

Example

import React from 'react';
import Button from 'wix-style-react/Button';

const App = () => (
    <Button onClick={() => console.log('thanks for clicking :)')}>
      Click me!
    </Button>
);

Build Configuration Prerequisites

wix-style-react uses Stylable, SASS and CSS Modules configuration by default. in order to use wix-style-react, your module bundler should be configured accordingly. Use Yoshi as build tool to avoid configuration. Otherwise, you should configure it on your own.

Example of create-react-app configuration

  • Run

    $ npm run eject
    $ npm i -D node-sass stylable @stylable/webpack-plugin @stylable/core
  • Enhance webpack configuration

    // config/webpack.config.js    
    const {StylableWebpackPlugin} = require('@stylable/webpack-plugin');
    //...
    {
      //...
      module: {
        rules: [
          {
            exclude: /\.st.css$/, //This must appear before the "oneOf" property
            oneOf: [
              //...
              {
                test: sassRegex,
                include: [
                  path.join(__dirname, '../node_modules/wix-animations'),
                  path.join(__dirname, '../node_modules/wix-style-react'),
                  path.join(__dirname, '../node_modules/bootstrap-sass')
                ],
                exclude: sassModuleRegex,
                use: getStyleLoaders(
                  {
                    modules: true,
                    importLoaders: 2,
                    sourceMap: isEnvProduction && shouldUseSourceMap,
                    camelCase: true,
                    localIdentName:'[name]__[local]___[hash:base64:5]',
                  },
                  'sass-loader'
                ),
                sideEffects: true,
              },
            ]
          },
        ],
        plugins: [
          //...
          new StylableWebpackPlugin({
             experimentalHMR: true,
             useEntryModuleInjection: true
           }),
        ]
      //...
      }
    }

Typescript support

Test drivers

All of wix-style-react components are 100% tested and supplies test drivers for easy interactions in your tests. Read more about Components Drivers

Troubleshooting

Please refer to the Troubleshooting page

Contributing

Please refer to the Contributing page

License

This project is offered under MIT License.

wix-style-react's People

Contributors

mykas avatar argshook avatar nirhart avatar nitayneeman avatar moshekerbel avatar shlomitc avatar faradey27 avatar yardnsm avatar yanivefraim avatar talza1810 avatar 3lok avatar amiryonatan avatar mastertheblaster avatar interal avatar alonbt avatar ipanasenko avatar itaibenda avatar ronami avatar egozie avatar nitayrabi avatar yavorsky avatar jefoss avatar rghorbani avatar adavidof avatar justenor avatar maxvektor avatar el-fuego avatar liorur avatar boriskor avatar netanelgilad avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.