Skip to content

Commit

Permalink
Merge pull request #211 from reapit/develop
Browse files Browse the repository at this point in the history
Merge dev to master
  • Loading branch information
trankhacvy authored Jan 6, 2020
2 parents d34a2b5 + be33977 commit 7f097d4
Show file tree
Hide file tree
Showing 18 changed files with 359 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = ({ config }) => {
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
include: path.resolve(__dirname, '../'),
include: path.resolve(__dirname, '../')
}
)
config.resolve.extensions.push('.ts', '.tsx')
Expand Down
12 changes: 7 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ module.exports = {
coveragePathIgnorePatterns: [
'<rootDir>[/\\\\](node_modules|src/types|src/tests|src/scripts|src/helpers|src/stylesq)[/\\\\]',
'.stories.tsx',
'src/index.tsx'
'src/index.tsx',
'index.ts',
'v2.ts'
],
modulePathIgnorePatterns: ['<rootDir>[/\\\\](node_modules|public)[/\\\\]'],
transform: {
Expand All @@ -18,10 +20,10 @@ module.exports = {
},
coverageThreshold: {
global: {
branches: 73,
functions: 90,
lines: 90,
statements: 90
branches: 85,
functions: 94,
lines: 95,
statements: 95
}
}
}
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@reapit/elements",
"version": "0.5.24",
"version": "0.5.25",
"description": "A collection of React components and utilities for building apps for Reapit Marketplace",
"main": "dist/index.js",
"umd:main": "dist/elements.umd.production.js",
Expand Down Expand Up @@ -33,15 +33,6 @@
},
"homepage": "https://github.com/reapit/elements#readme",
"devDependencies": {
"@types/react": "^16.9.2",
"@types/react-dom": "^16.9.0",
"@types/react-router": "^5.0.3",
"@types/react-router-dom": "^4.3.5",
"@types/enzyme": "^3.10.3",
"@types/jest": "^24.0.17",
"@types/jsonwebtoken": "^8.3.4",
"@types/node": "^12.7.1",
"@types/storybook__react": "^4.0.2",
"@babel/core": "^7.5.5",
"@octokit/rest": "^16.35.0",
"@storybook/addon-actions": "^5.2.6",
Expand All @@ -54,6 +45,15 @@
"@storybook/cli": "^5.2.6",
"@storybook/react": "^5.2.6",
"@storybook/storybook-deployer": "^2.8.1",
"@types/enzyme": "^3.10.3",
"@types/jest": "^24.0.17",
"@types/jsonwebtoken": "^8.3.4",
"@types/node": "^12.7.1",
"@types/react": "^16.9.2",
"@types/react-dom": "^16.9.0",
"@types/react-router": "^5.0.3",
"@types/react-router-dom": "^4.3.5",
"@types/storybook__react": "^4.0.2",
"awesome-typescript-loader": "^5.2.1",
"babel-loader": "^8.0.6",
"compare-versions": "^3.5.1",
Expand Down Expand Up @@ -106,7 +106,8 @@
"react-google-map": "^3.1.1",
"react-google-maps-loader": "^4.2.5",
"react-icons": "^3.7.0",
"react-table": "7.0.0-alpha.35"
"react-table": "7.0.0-alpha.35",
"styled-components": "^4.4.1"
},
"peerDependencies": {
"react": "^16.11.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ exports[`HelpGuide HelpGuide.Step should match a snapshot 1`] = `
<component />
</div>
</div>
<div
className="helpguide-wrapper-graphic"
>
<div
className="helpguide-graphic"
/>
</div>
</Component>
`;

Expand Down
83 changes: 44 additions & 39 deletions src/components/HelpGuide/help-guide.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { storiesOf } from '@storybook/react'
import { HelpGuide } from '.'
import { useHelpGuideContext } from './context'
import { Button } from '../Button'
import { FlexContainerBasic, Content, FlexContainerResponsive } from '../Layout'

const imageUrl = 'https://1001freedownloads.s3.amazonaws.com/vector/thumb/63319/Placeholder.png'

Expand Down Expand Up @@ -66,44 +67,48 @@ const ComponentC = () => {

storiesOf('HelpGuide', module).add('Primary', () => {
return (
<section className="section">
<HelpGuide>
<HelpGuide.Step
id="step-1"
component={ComponentA}
heading="Heading-1"
subHeading="SubHeading-1"
graphic={<img src={imageUrl} />}
/>
<HelpGuide.Step
id="step-2"
component={ComponentB}
heading="Heading-2"
subHeading="SubHeading-2"
graphic={<img src={imageUrl} />}
/>
<HelpGuide.Step
id="step-3"
component={ComponentB}
heading="Heading-3"
subHeading="SubHeading-3"
graphic={<img src={imageUrl} />}
/>
<HelpGuide.Step
id="step-4"
component={ComponentB}
heading="Heading-4"
subHeading="SubHeading-4"
graphic={<img src={imageUrl} />}
/>
<HelpGuide.Step
id="step-5"
component={ComponentC}
heading="Heading-5"
subHeading="SubHeading-5"
graphic={<img src={imageUrl} />}
/>
</HelpGuide>
</section>
<FlexContainerBasic flexColumn hasPadding>
<Content>
<FlexContainerResponsive flexColumn hasBackground hasPadding>
<HelpGuide>
<HelpGuide.Step
id="step-1"
component={ComponentA}
heading="Heading-1"
subHeading="SubHeading-1"
graphic={<img src={imageUrl} />}
/>
<HelpGuide.Step
id="step-2"
component={ComponentB}
heading="Heading-2"
subHeading="SubHeading-2"
graphic={<img src={imageUrl} />}
/>
<HelpGuide.Step
id="step-3"
component={ComponentB}
heading="Heading-3"
subHeading="SubHeading-3"
graphic={<img src={imageUrl} />}
/>
<HelpGuide.Step
id="step-4"
component={ComponentB}
heading="Heading-4"
subHeading="SubHeading-4"
graphic={<img src={imageUrl} />}
/>
<HelpGuide.Step
id="step-5"
component={ComponentC}
heading="Heading-5"
subHeading="SubHeading-5"
graphic={<img src={imageUrl} />}
/>
</HelpGuide>
</FlexContainerResponsive>
</Content>
</FlexContainerBasic>
)
})
2 changes: 1 addition & 1 deletion src/components/HelpGuide/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ HelpGuide.Step = function({ component: Component, heading, subHeading, graphic }
<Component />
</div>
</div>
{!isMobile() && (
{!isMobile() && graphic && (
<div className="helpguide-wrapper-graphic">
<div className="helpguide-graphic">{graphic}</div>
</div>
Expand Down
7 changes: 7 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as v2 from './v2'
// Hooks
export * from './hooks/UsePortal'

Expand Down Expand Up @@ -53,3 +54,9 @@ export * from './utils/completed-section/completed-sections'
export * from './utils/combine-address/combine-address'
export * from './utils/is-base64'
export * from './utils/device-detection/device-detection'

const elements = {
v2: v2
}

export default elements
7 changes: 5 additions & 2 deletions src/styles/components/help-guide.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

.helpguide-wrapper {
opacity: 0;
transition: all 0.3s;
transition: all 0.3s ease-in-out;
position: absolute;
width: 100%;
top: 0;
transform: translate(100%, 0);
@media (min-width: 768px) {
top: unset;
transform: translate(0, 100%);
}
}
Expand All @@ -33,6 +32,10 @@
.helpguide-graphic {
max-width: 400px;
margin: auto;
> img {
max-width: 100%;
height: auto;
}
}

.numbers-timeline {
Expand Down
1 change: 1 addition & 0 deletions src/v2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './v2/src'
1 change: 1 addition & 0 deletions src/v2/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './typography'
47 changes: 47 additions & 0 deletions src/v2/src/components/typography/__snapshots__/h1.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`H1 should match snapshot 1`] = `
<StyledComponent
forwardedComponent={
Object {
"$$typeof": Symbol(react.forward_ref),
"_foldedDefaultProps": Object {
"theme": Object {
"h1": Object {
"color": "black",
},
},
},
"attrs": Array [],
"componentStyle": ComponentStyle {
"componentId": "sc-bdVaJa",
"isStatic": false,
"rules": Array [
"
color: ",
[Function],
"
font-size: 1em;
",
],
},
"displayName": "styled.h1",
"foldedComponentIds": Array [],
"render": [Function],
"styledComponentId": "sc-bdVaJa",
"target": "h1",
"toString": [Function],
"warnTooManyClasses": [Function],
"withComponent": [Function],
}
}
forwardedRef={null}
theme={
Object {
"h1": Object {
"color": "black",
},
}
}
/>
`;
10 changes: 10 additions & 0 deletions src/v2/src/components/typography/h1.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'
import { shallow } from 'enzyme'
import { H1 } from './h1'

describe('H1', () => {
it('should match snapshot', () => {
const wrapper = shallow(<H1 />)
expect(wrapper).toMatchSnapshot()
})
})
17 changes: 17 additions & 0 deletions src/v2/src/components/typography/h1.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import styled from 'styled-components'
import { TYPOGRAPHY_TITLE_FONT_COLOR } from '../../styles'

export const H1 = styled.h1`
color: ${props => props.theme.h1.color}
font-size: 1em;
`

H1.defaultProps = {
theme: {
h1: {
color: TYPOGRAPHY_TITLE_FONT_COLOR
}
}
}

export default H1
1 change: 1 addition & 0 deletions src/v2/src/components/typography/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as H1 } from './h1'
1 change: 1 addition & 0 deletions src/v2/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './components'
61 changes: 61 additions & 0 deletions src/v2/src/styles/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
export interface Theme {
h1: {
color: string
}
}

// Typography
export const TYPOGRAPHY_TITLE_FONT_COLOR = 'black'
export const TYPOGRAPHY_TITLE_FONT_WEIGHT = 600
export const TYPOGRAPHY_TITLE_MARGIN_TOP = '1.2rem'
export const TYPOGRAPHY_TITLE_MARGIN_BOTTOM = '0.5rem'

// Colors
export const WHITE = '#fff'
export const BLACK = '#12263f'
export const GREY_DARK = '#556986'
export const GREY = '#95aac9'
export const GREY_LIGHTER = '#eef3f9'
export const GREY_LIGHTEST = '#f9fbfd'

export const GREEN_LIGHTER = '#acf2bd'
export const GREEN_LIGHTEST = '#e6ffed'
export const RED_LIGHTER = '#fdb8c0'
export const RED_LIGHTEST = '#ffeef0'

export const REAPIT_DARK_BLUE = '#262f69'
export const REAPIT_DARK_BLUE_DARKENED = '#1e2554'
export const REAPIT_MID_BLUE = '#0061a8'
export const REAPIT_LIGHT_BLUE = '#23a4de'
export const REAPIT_LIGHTEST_BLUE = '#7bc9eb'
export const REAPIT_LIGHTEST_BLUE_LIGHTENED = '#d4edf8'

export const REAPIT_ORANGE = '#ec631b'
export const REAPIT_LIME = '#cddb00'
export const REAPIT_TEAL = '#006580'
export const REAPIT_PLUMB = '#7a2c81'
export const REAPIT_PURPLE = '#a4185c'
export const REAPIT_GOLD = '#ffb71b'
export const REAPIT_GREEN = '#a0c862'
export const REAPIT_RED = '#d3033d'

// Font
export const FAMILY_SANS_SERIF = 'Roboto, Helvetica, Arial, sans-serif'
export const FONT_SIZE = '14px'
// Layout
export const LAYOUT_BASE = '1rem'
// Generic layout values that scale to rem base
export const LAYOUT_QUARTER = 'calc(1rem / 4)'
export const LAYOUT_THIRD = 'calc(1rem / 3)'
export const LAYOUT_HALF = 'calc(1rem / 2)'
export const LAYOUT_TWO_THIRD = 'calc(1rem * 0.67)'
export const LAYOUT_THREE_QUARTER = 'calc(1rem * 0.75)'
export const LAYOUT_ONE_QUARTER = 'calc(1rem * 1.25)'
export const LAYOUT_ONE_HALF = 'calc(1rem * 1.5)'
export const LAYOUT_DOUBLE = 'calc(1rem * 2)'
export const LAYOUT_TWO_HALF = 'calc(1rem * 2.5)'
export const LAYOUT_TRIPLE = 'calc(1rem * 3)'
export const LAYOUT_QUADRUPLE = 'calc(1rem * 4)'
export const LAYOUT_SEXTUPLE = 'calc(1rem * 6)'
export const MENU_WIDTH = '18rem'
export const PAGE_CONTAINER = 'calc(100vw - 18rem)'
Loading

0 comments on commit 7f097d4

Please sign in to comment.