Skip to content

Instantly share code, notes, and snippets.

View s-barrah's full-sized avatar

Sidney Barrah s-barrah

View GitHub Profile
@s-barrah
s-barrah / keybase.md
Created November 21, 2018 11:29
Keybase

Keybase proof

I hereby claim:

  • I am s-barrah on github.
  • I am sbarrah (https://keybase.io/sbarrah) on keybase.
  • I have a public key ASBCuuNCKD73I2o9t5wVpKzt4U19REE6v1hNAfZRekthpAo

To claim this, I am signing this object:

@s-barrah
s-barrah / babel.config.js
Created June 29, 2020 21:15
Babel configuration
module.exports = function (api) {
api.cache(true);
const presets = [['react-app', { absoluteRuntime: false }]];
const plugins = [['babel-plugin-styled-components']];
return {
presets,
plugins,
};
@s-barrah
s-barrah / styleguide.config.js
Last active July 2, 2020 21:13
Styleguide config
const path = require('path');
const { version } = require('./package');
module.exports = {
getComponentPathLine(componentPath) {
const name = path.basename(componentPath, '.tsx');
return `import { ${name} } from 'react-component-library';`;
},
styleguideComponents: {
Wrapper: path.join(__dirname, 'src/styleguide/ThemeWrapper')
@s-barrah
s-barrah / introduction.md
Created June 29, 2020 21:54
Component library introduction documentation

React Component Library

This component library is built using react-styleguidist, documenting the layouts, design patterns and components to be used across our sites and products.

@s-barrah
s-barrah / Text.tsx
Last active July 3, 2020 00:32
Text component
import * as React from 'react';
import * as PropTypes from 'prop-types';
import styled, { css } from 'styled-components';
interface ITheme {
color?: (colorName: string) => string,
fontSize?: (size: string) => string,
fontFamily?: (family: string) => string,
breakpoint?: (size: string) => string,
@s-barrah
s-barrah / RichText.tsx
Last active July 11, 2020 22:01
RichText component
import * as React from 'react';
import * as PropTypes from 'prop-types';
import styled from 'styled-components';
interface IInnerProps {
align: string;
}
interface IRichTextProps extends IInnerProps {
markup: string;
@s-barrah
s-barrah / Text.md
Created July 3, 2020 00:46
Text component readme
<div>
  <Text tag="h3" height="5">
    Heading 3 high
  </Text>
  <Text tag="h3" weight="1000">
    Heading 3 heavy
  </Text>
 
@s-barrah
s-barrah / RichText.md
Created July 3, 2020 00:48
RichText component readme
<RichText
  align={'center'}
  markup={'<p>Some <strong>strong</strong> test markup</p>'}
/>
import * as React from 'react';
import renderer from 'react-test-renderer';
import theme from '../theme/project1/theme';
import ThemeProvider from '../theme/ThemeProvider';
export default function renderWithTheme(component: JSX.Element) {
return renderer.create(<ThemeProvider theme={theme}>{component}</ThemeProvider>);
}
import * as React from 'react';
import 'jest-styled-components';
import renderWithTheme from '../../../hoc/shallowWithTheme';
import Text from './Text';
it('Atoms/Text component - renders xl yellow paragraph correctly', () => {
const tree = renderWithTheme(
<Text tag="p" size="xl" color="yellow">
My paragraph xl and yellow