Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
.env
1,494 changes: 632 additions & 862 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 15 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"name": "components",
"version": "1.0.0",
"version": "0.1.0",
"repository": "https://github.com/10digits/components.git",
"description": "",
"main": "index.js",
"main": "dist/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"storybook": "start-storybook -p 6006",
"build": "BABEL_ENV=production babel src -d dist",
"build-storybook": "build-storybook"
},
"keywords": [],
Expand All @@ -14,12 +16,18 @@
"dependencies": {
"dayjs": "^1.8.16"
},
"babel": {
"presets": [
"react-app"
]
},
"devDependencies": {
"@babel/core": "^7.6.2",
"@storybook/addon-actions": "^5.2.1",
"@storybook/addon-links": "^5.2.1",
"@storybook/addons": "^5.2.1",
"@storybook/react": "^5.2.1",
"@babel/cli": "^7.6.4",
"@babel/core": "^7.6.4",
"@storybook/addon-actions": "^5.2.4",
"@storybook/addon-links": "^5.2.4",
"@storybook/addons": "^5.2.4",
"@storybook/react": "^5.2.4",
"babel-loader": "^8.0.6"
}
}
2 changes: 1 addition & 1 deletion src/Blockquote/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import './styles.css';

const Blockquote = props => (
<blockquote className="Blockquote">{props.children}</blockquote>
<blockquote className="Blockquote"><span className="Blockquote__text">{props.children}</span></blockquote>
);

Blockquote.propTypes = {
Expand Down
41 changes: 30 additions & 11 deletions src/Blockquote/styles.css
Original file line number Diff line number Diff line change
@@ -1,22 +1,41 @@
.Blockquote {
padding-left: 1.3rem;
margin-left: 2.6rem;
border-left: 6px solid #838383;
height: 3rem;
font-size: 1.2rem;
position: relative;
font-size: 1.6rem;
margin: 0;
display: flex;
flex-direction: row;
align-items: center;
margin: 1.7rem 0;
}

.Blockquote__text {
text-align: center;
font-style: oblique;
font-family: 'Merriweather';
font-family: Raleway, sans-serif;
font-weight: 200;
margin: 20px auto;
padding: 14px;
position: relative;
border-top: 3px solid #d476d4;
border-bottom: 3px solid violet;
transform: rotate(-1.2deg);
}

.Blockquote__text::before {
font-style: initial;
content: '‟';
font-size: 5rem;
position: absolute;
top: -2rem;
left: -2rem;
color: #cdcdcd;
}

.Blockquote::before {
.Blockquote__text::after {
font-style: initial;
content: '‟';
font-size: 3.5rem;
font-size: 5rem;
position: absolute;
left: -2.5rem;
bottom: -2rem;
right: -2rem;
color: #cdcdcd;
transform: rotate(180deg);
}
48 changes: 37 additions & 11 deletions src/Clickable/styles.css
Original file line number Diff line number Diff line change
@@ -1,31 +1,57 @@
.Clickable {
line-height: 1.4;
font-weight: 700;
}

a.Clickable {
display: inline-block; /* prevents word break needed for background hover effect */
color: inherit;
font-weight: bold;
text-decoration: none;
border-bottom: 1px solid;
transition: cubic-bezier(0.45, 1.02, 0.75, 0.92) 0.2s;
letter-spacing: 0.02rem;
padding: 0 1px;
border-bottom: 2px solid #ffc600;
letter-spacing: 0.05rem;
padding: 0 3px;
position: relative;
transition: color cubic-bezier(0.45, 1.02, 0.75, 0.92) 0.2s;
}

a::before {
transition: height cubic-bezier(0.45, 1.02, 0.75, 0.92) 0.2s;
content: '';
height: 0;
position: absolute;
left: 0;
right: 0;
bottom: 0;
background-color: #ffc600;
z-index: -1;
}

a:hover::before {
height: 100%;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  /* bottom border grows to fill entire background */

}

a.Clickable:hover {
color: #ff8811;
border-bottom-style: dashed;
color: #fff;
}

button.Clickable {
font-size: 0.7rem;
appearance: none;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is necessary - it's just telling the browser not to use system default styling - which is the default anyway.

background: #f7f7f7;
border: 1px solid black;
border-bottom-color: rgba(0, 0, 0, 0.7);
border-radius: 3px;
border: 1px solid #000000;
box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.075);
color: #838383;
cursor: pointer;
line-height: 1.2rem;
letter-spacing: 0.1rem;
margin: 5px 0 0 5px;
padding: 6px 15px 7px;
overflow: visible;
padding: 9px 15px 10px;
position: relative;
letter-spacing: 0.02rem;
text-align: center;
text-transform: uppercase;
user-select: none;
}

button.Clickable:hover {
Expand Down
61 changes: 61 additions & 0 deletions src/CountBadge/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React, { Fragment } from 'react';
import PropTypes from 'prop-types';

import './styles.css';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create an issue for styled components

import classnames from 'classnames';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move up


const CountBadge = ({
children,
hideCount,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isCountHidden

isAttached,
fillColor,
strokeColor,
size,
}) => {
const count =
children > 99 ? (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Magic numbers. Replace with const maxDisplayableCount = 99;

<Fragment>
99<sup>+</sup>
</Fragment>
) : (
children
);
return (
<div
className={classnames([
'CountBadge',
{
'CountBadge__is-attached': isAttached,
},
])}
style={{
color: strokeColor,
backgroundColor: fillColor,
fontSize: size / 2,
height: size,
width: size,
}}
title={children}
>
{hideCount ? null : count}
</div>
);
};

CountBadge.propTypes = {
hideCount: PropTypes.bool,
children: PropTypes.string.isRequired,
strokeColor: PropTypes.string,
fillColor: PropTypes.string,
size: PropTypes.number,
};

CountBadge.defaultProps = {
hideCount: false,
isAttached: false,
strokeColor: '#ffffff',
fillColor: '#d01c1c',
size: 24,
};

export default CountBadge;
31 changes: 31 additions & 0 deletions src/CountBadge/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.CountBadge {
align-items: center;
border-radius: 100%;
display: flex;
font-weight: bold;
justify-content: center;
margin: 1px;
position: relative;
}

.CountBadge__is-attached {
position: absolute;
top: 0;
right: 0;
transform: translate(55%, -55%);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel that this relies on the outer element having a position relative which doesn't encapsulate this component - it creates a dependency on the outside world rather than being atomic.

Options:

  1. Don't support is--attached
  2. Find parent and bind to position using getBoundingClientRect.

Obviously option 2 will have a impact on performance, so should consider looking at stifling re-renders.

For now, let's remove this feature and open an issue to investigate and add.

}

.CountBadge::after {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we leave some more comments in the CSS as to what the intent of the pseudo class is.

border-radius: 100%;
border: 0.18em solid;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we need an explicit inherit for the colour?

bottom: -1px; /* -1px on position to tackle background colour fuzzing */
content: '';
left: -1px;
position: absolute;
right: -1px;
top: -1px;
}

sup {
transform: translateY(-20%);
}
7 changes: 4 additions & 3 deletions src/Field/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
color: #838383;
display: flex;
font-size: 0.7rem;
font-weight: 300;
font-weight: 400;
height: 1.45rem;
line-height: 1.45rem;
margin-left: 1rem;
Expand All @@ -25,13 +25,14 @@
}

.Field__help {
font-weight: 300;
color: #838383;
font-weight: 400;
color: #000000;
padding: 0.4rem 0;
display: flex;
flex-basis: 100%;
flex-shrink: 0;
font-size: 0.85rem;
line-height: 1.25rem;
}

.Field__has-error {
Expand Down
31 changes: 21 additions & 10 deletions src/H/styles.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
.H {
font-family: 'Montserrat';
font-family: Raleway, sans-serif;
line-height: 2.5rem;
font-weight: 400;
text-transform: uppercase;
letter-spacing: 1px;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rem?

margin: 1.25rem 0;
/* font-family: 'Montserrat', sans-serif;
line-height: 1.5;
font-weight: 800;
font-weight: 800; */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean up comment

}

.H1 {
Expand All @@ -15,12 +21,12 @@
}

.H3 {
font-size: 1rem;
font-size: 1.2rem;
margin: 0 0 20px 0;
}

.H4 {
font-size: 0.8rem;
font-size: 1rem;
margin: 0 0 20px 0;
}

Expand All @@ -29,7 +35,7 @@
position: relative;
}

.H__is-title::after {
.H__is-title::before {
content: '';
position: absolute;
height: 3px;
Expand All @@ -40,18 +46,23 @@
}

.H__subtitle {
color: #555;
line-height: 1;
font-weight: 400;
font-size: 0.75rem;
color: #999;
font-weight: 700;
letter-spacing: 3px;
line-height: 1.45rem;
margin: 0;
text-transform: uppercase;
display: block;
}

.H1 > .H__subtitle,
.H2 > .H__subtitle {
font-size: 0.6em;
font-size: 0.9rem;
}

.H3 > .H__subtitle,
.H4 > .H__subtitle {
font-size: 0.8em;
font-size: 0.7rem;
line-height: 1rem;
}
5 changes: 3 additions & 2 deletions src/HR/styles.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.HR {
width: 90%;
border: none;
background-color: #222;
height: 1px;
background-color: #ffc600;
height: 2px;
transform: rotate(-0.4deg);
}
2 changes: 1 addition & 1 deletion src/Image/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
margin: auto;
margin-top: 0.6rem;
text-align: center;
font-family: 'Cascadia Code';
font-family: 'Source Code Pro', monospace;
}

.Image {
Expand Down
2 changes: 1 addition & 1 deletion src/Input/styles.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.Input {
font-family: 'Merriweather';
font-family: Raleway, sans-serif;
font-size: 1rem;
margin-top: 0.4rem;
border: 1px solid black;
Expand Down
2 changes: 2 additions & 0 deletions src/P/styles.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.P {
font-family: Raleway, sans-serif;
font-weight: 400;
line-height: 1.5;
}
Loading