How to use the @pluralsight/ps-design-system-theme/react.js.useTheme function in @pluralsight/ps-design-system-theme

To help you get started, we’ve selected a few @pluralsight/ps-design-system-theme 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 pluralsight / design-system / packages / switch / src / react / index.js View on Github external
const Switch = React.forwardRef((props, forwardedRef) => {
  const { checked, children, disabled, error, ...rest } = props

  const ref = React.useRef()
  React.useImperativeHandle(forwardedRef, () => ref.current)

  const themeName = useTheme()
  const [isFocused, setIsFocused] = React.useState(false)

  const handleBlur = combineFns(() => {
    setIsFocused(false)
  }, props.onBlur)

  function handleClick(evt) {
    if (disabled || !isFunction(props.onClick)) return

    props.onClick(!props.checked)
  }

  const handleFocus = combineFns(() => {
    setIsFocused(true)
  }, props.onFocus)
github pluralsight / design-system / packages / checkbox / src / react / index.js View on Github external
const Checkbox = React.forwardRef((props, forwardedRef) => {
  const themeName = useTheme()

  const ref = React.useRef()
  React.useImperativeHandle(forwardedRef, () => ref.current)

  const square = React.createRef()

  React.useEffect(
    function updateIndetermiateAttr() {
      if (!ref.current) return
      ref.current.indeterminate = props.indeterminate
    },
    [props.indeterminate]
  )

  const handleKeyDown = evt => {
    if (evt.key === 'Enter' || evt.key === ' ') handleClick(evt)
github pluralsight / design-system / packages / datawell / src / react / index.js View on Github external
const DataWell = React.forwardRef((props, ref) => {
  const themeName = useTheme()

  return (
    <div>
      
        <div>{props.label}</div>
      

      <div>{props.children}</div>
      <div>{props.subLabel}</div></div>
github pluralsight / design-system / packages / radio / src / react / button.js View on Github external
const Button = React.forwardRef((props, forwardedRef) => {
  const themeName = useTheme()

  const ref = React.useRef()
  React.useImperativeHandle(forwardedRef, () => ref.current)

  const circleRef = React.useRef()

  function handleClick(evt) {
    const value = evt.target.value
    props._onClick(evt, value)

    if (isFunction(props.onClick)) props.onClick(evt, value)
    props._onFocus(evt, value)

    circleRef.current.focus()
  }