Giter VIP home page Giter VIP logo

web-toolkit's Introduction

Eurosport Web Toolkit

npm version

A collection of components to share common functionality across teams.

View the storybook

How to use

npm install @eurosport/web-toolkit emotion@9 react-emotion@9 emotion-theming@9 polished@2

All available components are exported as named exports so you can pull them in easily:

import { ThemeProvider } from 'emotion-theming';
import { injectStyles, theme, Button } from '@eurosport/web-toolkit';

injectStyles();

const MyApp = () => (
  <ThemeProvider theme={theme}>
    <Button>Hello!</Button>
  </ThemeProvider>
);

Documentation

Link

The Link component use a default prop "linkComponent" which is a function returning an anchor tag. If you want to override this behaviour, you can specify a custom function in your app as below :

import { RouterLink } from 'react-router-dom';
import { Link } from '@eurosport/web-toolkit';

Link.defaultProps.linkComponent = ({ href, children, ...props }) => (
  <RouterLink {...props} to={href}>
    {children}
  </RouterLink>
);

If a component defines a prop "linkComponent", then you can override the link behaviour for one instance of this component, by passing a custom function to this prop.

import { RouterLink } from 'react-router-dom';
import { Card } from '@eurosport/web-toolkit';

const overridenLink = ({ href, children, ...props }) => (
  <RouterLink {...props} to={href}>
    {children}
  </RouterLink>
);

const cardData = {};

<Card.Content card={cardData} type="article" linkComponent={overridenLink} />;
web-toolkit dependencies which needs to be installed on your own:
"emotion": "9",
"emotion-theming": "9",
"polished": "2",
"prop-types": "15",
"react": "16",
"react-emotion": "9"

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.