How to use the @tds/shared-typography.sup function in @tds/shared-typography

To help you get started, we’ve selected a few @tds/shared-typography 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 / Paragraph / Paragraph.jsx View on Github external
const paragraphSize = ({ size }) => typography[size]
const paragraphBold = ({ bold, size }) => (bold ? typography.boldFont : typography[`${size}Font`])
const paragraphAlign = ({ align }) => ({
  textAlign: align,
})

export const StyledParagraph = styled.p(
  paragraphColor,
  typography.wordBreak,
  spacing.noSpacing,
  paragraphInheritColor,
  paragraphSize,
  paragraphBold,
  paragraphAlign,
  { sup: typography.sup }
)

/**
 * Block text as an HTML `<p>` element.
 *
 * @version ./package.json
 */
const Paragraph = ({ children, ...rest }, context) =&gt; (
  
    {children}
  
)

Paragraph.propTypes = {
  /**
   * Embolden paragraph text without conveying any special importance or relevance.</p>
github telus / tds-core / packages / Text / Text.jsx View on Github external
import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'

import * as typography from '@tds/shared-typography'
import { safeRest } from '@tds/util-helpers'

const textColor = ({ invert }) =&gt; (invert ? typography.invertedColor : typography.color)
const textInheritColor = ({ inheritColor }) =&gt; (inheritColor ? { color: 'inherit' } : undefined)
const textSize = ({ size }) =&gt; typography[size]
const textBold = ({ bold, size }) =&gt; (bold ? typography.boldFont : typography[`${size}Font`])
const textBlock = ({ block }) =&gt; (block ? typography.blockText : undefined)

export const StyledText = styled.span(textColor, textInheritColor, textSize, textBold, textBlock, {
  sup: typography.sup,
})

/**
 * Inline text usually as an HTML `<span>` element.
 *
 * @version ./package.json
 */
const Text = ({ children, ...rest }, context) =&gt; (
  
    {children}
  
)

Text.propTypes = {
  /**
   * If true, renders a block level element.</span>