How to use the former-kit.ThemeConsumer function in former-kit

To help you get started, we’ve selected a few former-kit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pagarme / artis / src / pages / Error.js View on Github external
import React from 'react'
import PropTypes from 'prop-types'
import {
  Grid,
  Row,
  Col,
  ThemeConsumer,
} from 'former-kit'

import SadEmoji from './../images/sad.svg'

const consumeTheme = ThemeConsumer('UIErrorPage')

const ErrorPage = ({ theme }) => (
github pagarme / artis / src / components / Cart / index.js View on Github external
omit,
  pipe,
  prop,
  propOr,
} from 'ramda'
import { ThemeConsumer } from 'former-kit'

import { toggleCart } from '../../redux/actions'
import { formatToBRL } from '../../utils/masks/'
import { Button } from '../'

import CartIcon from '../../images/cart.svg'
import CloseIcon from '../../images/clear-close.svg'
import NavigateBack from '../../images/navigate_back.svg'

const consumeTheme = ThemeConsumer('UICart')

const formatShippingFee = ifElse(
  equals(0),
  always('Gratis!'),
  formatToBRL
)

const formatZipcode = pipe(
  insert(5, '-'),
  join('')
)

const hasShippingAddress = anyPass([
  prop('street'),
  prop('number'),
  prop('additionalInfo'),
github pagarme / artis / src / pages / Payment / CreditCardAndBoleto.js View on Github external
import CreditCardForm from './CreditCardForm'
import BoletoForm from './BoletoForm'

import {
  required,
  minLength,
  maxLength,
  isValidDate,
} from '../../utils/validations'
import updateMultipleAmount from '../../utils/helpers/updateMultipleAmount'
import { formatToBRL } from './../../utils/masks/'
import getInstallments from './../../utils/helpers/getInstallments'
import getInputAmountValue from './../../utils/helpers/getInputAmountValue'

const consumeTheme = ThemeConsumer('UIPaymentPage')

const defaultColSize = 12
const mediumColSize = 6

class CreditCardAndBoleto extends Component {
  state = {
    formData: {},
    formValid: false,
    inputAmountNames: {
      first: 'creditcard-amount',
      second: 'boleto-amount',
    },
  }

  handleChangeForm = (newFormData, errors) => {
    const { formData, inputAmountNames } = this.state
github pagarme / artis / src / components / LoadingInfo / index.js View on Github external
import React from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
import {
  Grid,
  Row,
  Col,
  ThemeConsumer,
} from 'former-kit'

const consumeTheme = ThemeConsumer('UILoadingInfo')

const defaultColSize = 12

const LoadingInfo = ({
  theme,
  title,
  subtitle,
  fullscreen,
}) => (
github pagarme / artis / src / pages / Payment / SwitchPayment.js View on Github external
addPageInfo,
  incrementFinalAmount,
  decrementFinalAmount,
  resetFinalAmount,
} from '../../actions'
import {
  required,
  minLength,
  maxLength,
  isValidDate,
} from '../../utils/validations'

import getInstallments from './../../utils/helpers/getInstallments'
import { applyDiscount } from './../../utils/calculations'

const consumeTheme = ThemeConsumer('UIPaymentPage')

const setPaymentMethod = ({
  defaultMethod,
  paymentConfig,
}) => defaultMethod || keys(paymentConfig)[0]

const createSwitchItems = ({
  theme,
  base,
  transaction,
  amount,
  isBigScreen,
  flipped,
  formData,
  handleFlipCard,
  paymentType,
github pagarme / artis / src / components / SuccessInfo / index.js View on Github external
import { connect } from 'react-redux'
import {
  Grid,
  Row,
  Col,
  ThemeConsumer,
} from 'former-kit'

import EmailForm from '../../containers/EmailForm'
import ActionList from '../ActionList'

import { formatToBRL } from '../../utils/masks/'

import successIcon from '../../images/success-icon.png'

const consumeTheme = ThemeConsumer('UISuccessInfo')

const iconColSize = 4
const contentColSize = 8
const defaultColSize = 12
const mediumColSize = 6

const handleCopyBarCode = (barcode) => {
  ReactGA.event({
    category: 'Boleto',
    action: 'Copy Bar Code',
  })

  copy(barcode)
}

class SuccessInfo extends React.Component {
github pagarme / artis / src / components / ActionList / index.js View on Github external
import React from 'react'
import PropTypes from 'prop-types'
import {
  Button,
  Row,
  Col,
  ThemeConsumer,
} from 'former-kit'

const consumeTheme = ThemeConsumer('UIActionList')
const defaultColSize = 12

const ActionList = ({ theme, buttons }) => (
  
    {
      buttons.map(buttonInfo => (
github pagarme / artis / src / components / Header / index.js View on Github external
import React from 'react'
import { ThemeConsumer } from 'former-kit'
import PropTypes from 'prop-types'
import classNames from 'classnames'
import {
  equals,
  not,
} from 'ramda'
import { ProgressBar } from '..'

import BackIcon from '../../images/navigate_back.svg'
import CloseIcon from '../../images/closeX.svg'

const consumeTheme = ThemeConsumer('UIHeader')

class Header extends React.Component {
  shouldComponentUpdate (nextProps) {
    const oldActiveStep = this.props.activeStep
    const newActiveStep = nextProps.activeStep

    return not(equals(oldActiveStep, newActiveStep))
  }

  render () {
    const {
      activeStep,
      handleCloseButton,
      handlePreviousButton,
      logoAlt,
      logoSrc,
github pagarme / artis / src / components / MessageInfo / Success / index.js View on Github external
import moment from 'moment'
import { ThemeConsumer } from 'former-kit'
import ReactGA from 'react-ga'
import copy from 'copy-to-clipboard'
import { propOr } from 'ramda'
import classNames from 'classnames'

import { ActionButton, Button } from './../../'
import { formatToBRL } from '../../../utils/masks/'
import SuccessIcon from '../../../images/confirmacao_sucesso.svg'
import CopyIcon from '../../../images/copy.svg'
import DownloadIcon from '../../../images/download.svg'
import CloseXIcon from '../../../images/closeX.svg'
import OrderIcon from '../../../images/pedido.svg'

const consumeTheme = ThemeConsumer('UISuccessMessageInfo')

const openLink = url => window.open(url, '_blank')

const formatExpirationAt = value => (
  value
    ? moment(value).format('L')
    : moment().add(1, 'days').format('L')
)

const handleBarcodeCopy = barcode => (
  () => {
    ReactGA.event({
      category: 'Boleto',
      action: 'Copy Bar Code',
    })
github pagarme / artis / src / components / DarkButton / index.js View on Github external
import React from 'react'
import PropTypes from 'prop-types'
import {
  Button,
  ThemeConsumer,
} from 'former-kit'

const consumeTheme = ThemeConsumer('UIDarkButton')

const DarkButton = ({
  icon,
  onClick,
  subtitle,
  theme,
  title,
}) => (
  <div>
    <button>
      <div>
        <p>
          {title}</p></div></button></div>

former-kit

<img src="https://avatars1.githubusercontent.com/u/3846050?v=4&s=127" width="127px" height="127px" align="left"/>

Apache-2.0
Latest version published 4 months ago

Package Health Score

67 / 100
Full package analysis