diff --git a/public/index.html b/public/index.html index 3a709838..ac2f466a 100644 --- a/public/index.html +++ b/public/index.html @@ -5,6 +5,43 @@ + + + diff --git a/src/containers/StyleguidePage/StyleguidePage.css b/src/containers/StyleguidePage/StyleguidePage.css index 62d4802d..343ee5e5 100644 --- a/src/containers/StyleguidePage/StyleguidePage.css +++ b/src/containers/StyleguidePage/StyleguidePage.css @@ -1,8 +1,78 @@ +:root { + --spacing-unit: 6px; +} + .root { padding: 1rem 0; } .withPadding, .defaultWrapperStyles { - padding: 1rem; + padding: 12px; +} + +/* Typography.example */ +.content { + +} + +.baselines { + background-image: url('data:image/svg+xml;utf8,'); + background-repeat: repeat; + + @media (min-width: 768px) { + background-image: url('data:image/svg+xml;utf8,'); + background-repeat: repeat; + } +} + + +.spacing2x { + margin: calc(2 * var(--spacing-unit)) 0; +} + +.fontsContainer { + display: flex; + flex-wrap: wrap; + margin-top: calc(4 * var(--spacing-unit)); + + &::after { + content: "."; + visibility: hidden; + display: block; + height: 0; + clear: both; + } +} + +.fontCard { + flex-basis: 300px; + display: flex; + flex-direction: column; + + /** + * FontCard contains 4px worth of borders, which needs to be factored in since we use + * box-sizing: border-box; + * In this case, we'll adjust margin-bottoms (24px - 4px = 20px) + */ + margin-bottom: calc(4 * var(--spacing-unit) - 4px); + margin-right: calc(2 * var(--spacing-unit)); +} + +.element { + border-style: solid; + border-color: #aaa; + border-width: 1px; +} + +.description { + flex-grow: 1; + width: 100%; + background-color: #f1f1f1; + padding: calc(2 * var(--spacing-unit)); + + border-style: solid; + border-color: #aaa; + border-width: 1px; + border-top-color: transparent; } diff --git a/src/containers/StyleguidePage/Typography.example.js b/src/containers/StyleguidePage/Typography.example.js new file mode 100644 index 00000000..2efb87e6 --- /dev/null +++ b/src/containers/StyleguidePage/Typography.example.js @@ -0,0 +1,137 @@ +import React, { PropTypes } from 'react'; +import classNames from 'classnames'; +import css from './StyleguidePage.css'; +import mpStyle from '../../marketplace.css'; + + +const Font = props => { + const { component: TextComponent, description, styling } = props; + return ( +
+
+ +
+
+

{description}

+
{styling}
+
+
+ ); +}; + +const { func, string } = PropTypes; + +Font.propTypes = { + component: func.isRequired, + description: string.isRequired, + styling: string.isRequired, +} + +const Fonts = () => { + const h1FontStyling = + `Styles affecting size: + font-size: 48px; + line-height: 54px; + padding: 5px 0 1px 0;`; + + const h2FontStyling = `Styles affecting size: + font-size: 30px; + line-height: 36px; + padding: 3.5px 0 2.5px 0;`; + + const h3FontStyling = `Styles affecting size: + font-size: 24px; + line-height: 30px; + padding: 3px 0 3px 0;`; + + const h4FontStyling = `Styles affecting size: + font-size: 20px; + line-height: 24px; + padding: 2px 0 4px 0;`; + + const h5FontStyling = `Styles affecting size: + font-size: 16px; + line-height: 24px; + padding: 3.5px 0 2.5px 0;`; + + const h6FontStyling = `Styles affecting size: + font-size: 14px; + line-height: 18px; + padding: 1.5px 0 4.5px 0;`; + + const bodyFontStyling = `Styles affecting size: + font-size: 18px; + line-height: 24px; + padding: 2.5px 0 3.5px 0;`; + + const tinyFontStyling = `Styles affecting size: + font-size: 13px; + line-height: 18px; + padding: 2px 0 4px 0;`; + + const fontsContainerClasses = classNames(css.fontsContainer, css.baselines); + + return ( +
+

+ The line-height of typographic elements is an multiple of 6px on mobile and multiple of 8px + on desktop. In addition to line-height, baselines are adjusted with vertical padding + (the sum of those paddings will be 6px on mobile or 8px on desktop). As a result one can + position following typographic elements with margins that are also multiples of 6px (or 8px). +

+

+ N.B. box-sizing is border-box, so borders affect to the total height of elements. +

+

+ TODO: breakpoints for desktop are missing (desktop fonts needs to be extracted. +

+
+ (

H1 (.h1Font): Lorem ipsum dolor sit amet

)} + description="Biggest font style. Used in main heading on a page. " + styling={h1FontStyling} + /> + (

H2 (.h2Font): Lorem ipsum dolor sit amet

)} + description="Works as a subtitle. Inline component using .h2Font can be aligned with .h1Font to the same baseline by dropping it 18px (e.g. with margin-top)." + styling={h2FontStyling} + /> + (

H3 (.h3Font): Lorem ipsum dolor sit amet

)} + description="Works as a subtitle and in sidebar menu." + styling={h3FontStyling} + /> + (

H4 (.h4Font): Lorem ipsum dolor sit amet

)} + description="Works as a subtitle." + styling={h4FontStyling} + /> + (
H5 (.h5Font): Lorem ipsum dolor sit amet
)} + description="Can be used as a subtitle and also as a label font for form inputs." + styling={h5FontStyling} + /> + (
H6 (.h6Font): Lorem ipsum dolor sit amet consectetur adebisci velit
)} + description="Works as a subtitle." + styling={h6FontStyling} + /> + (

Default font (.bodyFont, p, button, etc.): Lorem ipsum dolor sit amet

)} + description="Paragraphs and other body texts." + styling={bodyFontStyling} + /> + (

Tiny mobile text (.tinyFont): Lorem ipsum dolor sit amet

)} + description="Very small print." + styling={tinyFontStyling} + /> +
+
+ ); +}; + +export const Typography = { + component: Fonts, + props: {}, +}; diff --git a/src/examples.js b/src/examples.js index 72747028..f0f91cb4 100644 --- a/src/examples.js +++ b/src/examples.js @@ -38,6 +38,7 @@ import * as PasswordForgottenForm import * as PayoutDetailsForm from './containers/PayoutDetailsForm/PayoutDetailsForm.example'; import * as SignupForm from './containers/SignupForm/SignupForm.example'; import * as StripePaymentForm from './containers/StripePaymentForm/StripePaymentForm.example'; +import * as Typography from './containers/StyleguidePage/Typography.example'; export { AddImages, @@ -69,4 +70,5 @@ export { StripePaymentForm, TabNav, Tabs, + Typography, }; diff --git a/src/index.css b/src/index.css deleted file mode 100644 index f433a76e..00000000 --- a/src/index.css +++ /dev/null @@ -1,45 +0,0 @@ -@import "sanitize.css"; - -/* Base font */ -html, input, button, a { - /* - Use Chalkboard font. This font is available in Mac OSX. Fallback - to Comic Sans MS, "although it is not a perfect substitute font - since the two are not metrically compatible". - - See: https://en.wikipedia.org/wiki/Chalkboard_(typeface) - */ - font-family: "Chalkboard", "ChalkboardSE-Regular", "Comic Sans MS", sans-serif; - color: #4A4A4A; -} - -h1, h2, h3, h4, h5, h6 { - font-weight: normal; - letter-spacing: -0.6px; -} - -h1 { - font-size: 24px; -} - -ul { - list-style: none; - padding: 0; -} - -label { - display: block; - font-weight: bold; - font-size: 14px; - margin-top: 20px; - margin-bottom: 10px; -} - -select { - border: none; -} - -textarea { - width: 100%; - border: 1px solid #ddd; -} diff --git a/src/index.js b/src/index.js index 9f4678ff..a82c6210 100644 --- a/src/index.js +++ b/src/index.js @@ -23,7 +23,7 @@ import { authInfo } from './ducks/Auth.duck'; import { fetchCurrentUser } from './ducks/user.duck'; import routeConfiguration from './routesConfiguration'; -import './index.css'; +import './marketplace.css'; const render = store => { // If the server already loaded the auth information, render the app diff --git a/src/marketplace.css b/src/marketplace.css new file mode 100644 index 00000000..28cb0521 --- /dev/null +++ b/src/marketplace.css @@ -0,0 +1,150 @@ +@import "sanitize.css"; + +/* FONTS */ +h1, h2, h3, h4, h5, h6, p, pre { + margin: 0; +} + +h1, +.h1Font { + font-family: "sofiapro", Helvetica, Arial, sans-serif; + font-weight: 400; + font-size: 48px; + line-height: 54px; + padding: 5px 0 1px 0; /* 5px + 1px = 6px */; + letter-spacing: -1px; + + /* TODO: this seems to be biggest font in Page titles (except in Hero) - is it h1 then? */ + @media (min-width: 768px) { + font-family: "sofiapro-semibold"; + font-size: 48px; + line-height: 56px; + padding: 7px 0 1px 0; /* 7 + 1 = 8px */ + letter-spacing: -1px; + } +} + +h2, +.h2Font { + font-family: "sofiapro", Helvetica, Arial, sans-serif; + font-weight: 600; + font-size: 30px; + line-height: 36px; + padding: 3.5px 0 2.5px 0; /* 3.5px + 2.5px = 6px */ + letter-spacing: -0.5px; + + /* TODO Are these correct settings? */ + @media (min-width: 768px) { + font-size: 24px; + line-height: 32px; + padding: 4px 0 4px 0; /* 4px + 4px = 8px */ + letter-spacing: -0.3px; + } +} + +h3, +.h3Font { + font-family: "sofiapro", Helvetica, Arial, sans-serif; + font-weight: 600; + font-size: 24px; + line-height: 30px; + padding: 3px 0 3px 0; /* 3px + 3px = 6px */ + letter-spacing: -0.4px; + + /* TODO Desktop styles needs to be extracted */ +} + +h4, +.h4Font { + font-family: "sofiapro", Helvetica, Arial, sans-serif; + font-weight: 600; + font-size: 20px; + line-height: 24px; + padding: 2px 0 4px 0; /* 2px + 4px = 6px */ + letter-spacing: -0.2px; + + /* TODO Desktop styles needs to be extracted */ +} + +h5, +.h5Font { + font-family: "sofiapro", Helvetica, Arial, sans-serif; + font-weight: 600; + font-size: 16px; + line-height: 24px; + padding: 3.5px 0 2.5px 0; /* 3.5px + 2.5px = 6px */ + letter-spacing: 0; + + /* TODO Desktop styles needs to be extracted */ +} + +h6, +.h6Font { + font-family: "sofiapro", Helvetica, Arial, sans-serif; + font-weight: 600; + font-size: 14px; + line-height: 18px; + padding: 1.5px 0 4.5px 0; /* 1.5px + 4.5px = 6px */ + letter-spacing: 0; + + /* TODO Desktop styles needs to be extracted */ +} + +html, +input, +button, +p, +pre, +.bodyFont { + font-family: "sofiapro", Helvetica, Arial, sans-serif; + font-weight: 500; + font-size: 18px; + line-height: 24px; + padding: 2.5px 0 3.5px 0; /* 2.5px + 3.5px = 6px */ + letter-spacing: -0.1px; + + /* TODO Desktop styles needs to be extracted */ +} + +.tinyFont { + font-family: "sofiapro", Helvetica, Arial, sans-serif; + font-weight: 400; + font-size: 13px; + line-height: 18px; + padding: 2px 0 4px 0; /* 2px + 4px = 6px */ + letter-spacing: -0.1px; + + /* TODO Desktop styles needs to be extracted */ +} + +/* COLORS */ +/* Base font color */ +html, +.textColor { + color: #4A4A4A; +} + +/* NORMALIZATIONS for other elements */ +/* TODO */ + +ul { + list-style: none; + padding: 0; +} + +label { + display: block; + font-weight: bold; + font-size: 14px; + margin-top: 20px; + margin-bottom: 10px; +} + +select { + border: none; +} + +textarea { + width: 100%; + border: 1px solid #ddd; +}