Giter Club home page Giter Club logo

betterplace-react-components's Introduction

npm Version Build Status peerDependencies Status devDependencies Status Dependency Status

betterplace-react-components

Development

For recommended vscode setup run yarn setup-vscode or npm run setup-vscode & then install workspace @recommended extensions. Note that src/javascript/apiV4.ts is autogenerated and needs to be manually copied over if relevant API parts change.

Installation

With yarn:

yarn add betterplace-react-components

With npm:

npm i betterplace-react-components

Usage

import { ProjectTeaser } from 'betterplace-react-components'

<ProjectTeaser project={betterplaceOrgApiV4Response}>
import { FacebookButton } from 'betterplace-react-components'

<FacebookButton shape='round' shareUrl='www.foo.bar' />

etc. - run yarn start to get a preview of all components.

Share buttons with utm_params

<FacebookButton
  shape='round'
  shareUrl='www.foo.bar'
  utmParams={{ utm_campaign: 'user_share', utm_medium: 'foo', utm_source: 'bar' }}
/>

Share Button Props

Required props Optional props
All shareUrl URL of the shared page (string)

shape
round Render a round sharing button without content(string)

square Render a square sharing button without content (string)

minimal Render a rectangle share button with icon and content

full Render a rounded share button with icon and content
boxShadow Add a bottom box shadow to the icon (boolean) - only for full and round shapes so far

utmParams: Representation of the utmParams to be attached to the shareUrl (object)

beforeOnClick: Add additional behaviour to the click action (function)

content: Button content to that needs to be set with minimal button option (string)

title: title attribute for the <button> element (string)

color: Color that overrides the default button color
FacebookButton - -
FacebookMessengerButton facebookAppId: Facebook App ID of your platform (string) -
TwitterButton - -
TelegramButton - teaser: Intro text for the sharing message (string)
WhatsappButton - teaser: Intro text for the sharing message (string)
EmailButton - subject: Subject of the email(string)

teaser: Intro text for the sharing message (string)
LinkButton - -
InstagramButton - -

Sharing with custom markup

You can also use the click action handler only in case you want to use custom styled buttons.

import { facebookShareAction } from 'betterplace-react-components'

const MyShareButton = () => {
  const handleClick = () => facebookShareAction({
    shareUrl: 'www.foo.bar',
    utmParams: { utm_campaign: 'user_share', utm_medium: 'foo', utm_source: 'bar' }
  })

  return <span onClick={handleClick}>i luv facebook</span>
}

Customization

There is no theming support yet. Some styles can be set via props, e.g.

<ProjectTeaser progressbarColor='#0000ff' />

Development

Install development / testing dependencies:

yarn

Run hot-reloading preview:

yarn start

Run tests:

yarn test

Release a new version:

yarn publish

License

betterplace-react-components is released under the Apache 2.0 license and Copyright 2018..2022 gut.org gAG.

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.