How to use @tds/shared-hocs - 5 common examples

To help you get started, we’ve selected a few @tds/shared-hocs 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 telus / tds-core / packages / Tooltip / Tooltip.jsx View on Github external
*
   * If a tooltip id is not provided, a unique tooltip id will be generated.
   */
  tooltipId: PropTypes.string,
  /* @ignore */
  forwardedRef: PropTypes.object,
}

const defaultProps = {
  direction: 'auto',
  connectedFieldLabel: undefined,
  tooltipId: undefined,
  forwardedRef: undefined,
}

const RefForwardedTooltip = withForwardedRef(T)
const Tooltip = React.forwardRef((props, ref) => )

Tooltip.propTypes = propTypes
Tooltip.defaultProps = defaultProps
T.propTypes = propTypes
T.defaultProps = defaultProps

Tooltip.displayName = 'Tooltip'

export default Tooltip
github telus / tds-core / packages / Link / Link.jsx View on Github external
/* @ignore */
  forwardedRef: PropTypes.object,
}
Link.defaultProps = {
  reactRouterLinkComponent: null,
  to: null,
  href: null,
  invert: undefined,
  forwardedRef: undefined,
}

Link.contextTypes = {
  inheritColor: PropTypes.bool,
}

export default withForwardedRef(Link)
github telus / tds-core / packages / TermsAndConditions / Footnote / FootnoteList.jsx View on Github external
'& > span': {
    ...mediumFont,
  },
  ...media.from('md').css({
    paddingLeft: '2rem',
  }),
})
const StyledFootnoteList = styled(StyledList)({
  ...sizeMedium,
  marginLeft: '1rem',
  ...media.from('md').css({
    marginLeft: 0,
  }),
})

const FootnoteList = withStyledComponent(StyledFootnoteList)(List)
const FootnoteListItem = withStyledComponent(StyledFootnoteListItem)(List.Item)

FootnoteList.Item = FootnoteListItem

export default FootnoteList
github telus / tds-core / packages / TermsAndConditions / Footnote / FootnoteList.jsx View on Github external
...mediumFont,
  },
  ...media.from('md').css({
    paddingLeft: '2rem',
  }),
})
const StyledFootnoteList = styled(StyledList)({
  ...sizeMedium,
  marginLeft: '1rem',
  ...media.from('md').css({
    marginLeft: 0,
  }),
})

const FootnoteList = withStyledComponent(StyledFootnoteList)(List)
const FootnoteListItem = withStyledComponent(StyledFootnoteListItem)(List.Item)

FootnoteList.Item = FootnoteListItem

export default FootnoteList
github telus / tds-core / packages / TermsAndConditions / Footnote / Footnote.jsx View on Github external
({ bodyHeight, isTextVisible }) => ({
    height: bodyHeight,
    opacity: isTextVisible ? 1 : 0,
  })
)

const StyledListContainer = styled.div({
  paddingTop: '1.5rem',
  paddingBottom: '2rem',
  ...media.from('md').css({
    paddingTop: '0rem',
    paddingBottom: '3rem',
  }),
})

const FocusTrap = withFocusTrap('div')

const usePrevious = value => {
  const ref = useRef()
  useEffect(() => {
    ref.current = value
  })
  if (ref.current) {
    return ref.current
  }
  return {}
}

const Footnote = props => {
  const { copy, number, content, onClose, isOpen, ...rest } = props
  const footnoteRef = useRef(null)
  const headerRef = useRef(null)

@tds/shared-hocs

TDS higher order components

MIT
Latest version published 2 years ago

Package Health Score

63 / 100
Full package analysis

Similar packages