How to use the @pluralsight/ps-design-system-theme.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 / errors / src / react / error-page.js View on Github external
const ErrorPage = props => {
  const themeName = useTheme()
  const allProps = {
    ...props,
    themeName
  }
  return (
    <div>
      {allProps.iconId &amp;&amp; icons[allProps.iconId] &amp;&amp; (
        <div>{icons[allProps.iconId]()}</div>
      )}
      <div>
        
          <h1>{allProps.text}</h1>
        
      </div>
      <div>
        </div></div>
github pluralsight / design-system / packages / verticaltabs / src / react / index.js View on Github external
({ children, open, tagName, toggle, getButtonAriaLabel, ...rest }, ref) =&gt; {
    const themeName = useTheme()
    const TagName = tagName
    return (
      
        <button aria-label="{getButtonAriaLabel()}">
          <div>
            <span>{children}</span>
            </div></button>
github pluralsight / design-system / packages / note / src / react / index.js View on Github external
export default function Note(props) {
  const themeName = useTheme()
  const [isHovered, setIsHovered] = React.useState(false)

  const handleMouseOver = (...args) => {
    setIsHovered(true)
    if (props.onMouseOver) props.onMouseOver(...args)
  }

  const handleMouseOut = (...args) => {
    setIsHovered(false)
    if (props.onMouseOut) props.onMouseOut(...args)
  }

  const hasActions = !!props.actionBar && props.actionBar.length > 0
  const hasAside = !!props.avatar
  const hasHeading = !!props.heading
  const hasMetadata = !!props.metadata && props.metadata.length > 0
github pluralsight / design-system / packages / tab / src / react / list-item.js View on Github external
const ListItem = React.forwardRef((props, ref) => {
  const themeName = useTheme()
  const tagName = props.href ? 'a' : 'button'
  const allProps = {
    ...props,
    themeName
  }
  return React.createElement(
    tagName,
    filterReactProps(
      {
        ...props,
        ...styles.listItem(allProps),
        'aria-selected': allProps.active,
        ref,
        role: 'tab',
        tabIndex: '-1'
      },
github pluralsight / design-system / packages / button / src / react / index.js View on Github external
const Button = React.forwardRef((props, ref) =&gt; {
  const themeName = useTheme()
  if (!ref) ref = React.useRef()
  const nonLoadingWidth = React.useMemo(() =&gt; {
    if (props.loading &amp;&amp; ref &amp;&amp; ref.current) {
      return ref.current.offsetWidth
    }
  }, [props.loading, ref])

  const tagName = props.href ? 'a' : 'button'
  const isLoadingWithNoText = !!nonLoadingWidth
  const allProps = {
    ...props,
    isLoadingWithNoText,
    iconOnly: React.Children.count(props.children) &lt;= 0,
    themeName
  }
github pluralsight / design-system / packages / verticaltabs / src / react / group.js View on Github external
const GroupHeader = forwardRef(({ children, tagName, ...rest }, ref) =&gt; {
  const themeName = useTheme()
  const TagName = tagName

  return (
    
      <div>
        <span>{children}</span>
      </div>
    
  )
})
github pluralsight / design-system / packages / verticaltabs / src / react / index.js View on Github external
({ active, children, header, itemType, ...rest }, ref) =&gt; {
    const themeName = useTheme()
    return (
      <li>
        <div>
          {cloneElement(header, { active })}
        </div>
        {children &amp;&amp; <ul>{children}</ul>}
      </li>
    )
  }
)
github pluralsight / design-system / packages / text / src / react / p.js View on Github external
const P = (props, context) =&gt; {
  const themeName = useTheme()

  return (
    <p>
      {props.children}
    </p>
  )
}
github pluralsight / design-system / packages / emptystate / src / react / index.js View on Github external
export default function EmptyState(props) {
  const [hasRenderedOnce, setHasRenderedOnce] = useState(false)
  const { ref, width } = useResizeObserver()
  const themeName = useTheme()

  useEffect(() =&gt; {
    setHasRenderedOnce(true)
  }, [])

  const hasPropSizeOverride = !!props.size
  const observableSize =
    width &lt;= renderSmallIfElementLessThan ? vars.sizes.small : vars.sizes.large

  const size = hasPropSizeOverride ? props.size : observableSize
  const ctx = { size, themeName }

  return (
github pluralsight / design-system / packages / verticaltabs / src / react / index.js View on Github external
Tier1.Header = forwardRef(({ active, children, icon, ...rest }, ref) =&gt; {
  const themeName = useTheme()
  const TagName = rest.href ? 'a' : rest.onClick ? 'button' : 'span'
  return (
    
      {icon &amp;&amp;
        cloneElement(icon, {
          size: Icon.sizes.medium,
          ...styles.itemIcon(themeName),
          ...(active ? { 'data-active': true } : {})
        })}
      <span>{children}</span>