Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(website): to style markdown pages (convert info dialog page) #573

Merged
merged 6 commits into from
Apr 29, 2019

Conversation

emmenko
Copy link
Member

@emmenko emmenko commented Apr 27, 2019

This PR focuses on styling the markdown pages, using the InfoDialog component page as an example.

  • convert InfoDialog readme to mdx (the readme will eventually just link to the website page)
  • render info dialog component snippet into the mdx page
  • improve color theme of code blocks
  • style markdown elements
  • change logo colors
    • generate favicons based on the logo
  • some other small improvements

I recommend to check the deployed branch if you want to see the result (info-dialog component page)


# InfoDialog

import { InfoDialog } from '@commercetools-frontend/application-components';
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the interactive part. The code below is basically what we had in the VRT test.

</InfoDialog>
</div>

### Description
Copy link
Member Author

Choose a reason for hiding this comment

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

From here below is just a copy of the README

@@ -21,7 +21,7 @@ module.exports = {
subgroup: [
{
label: 'InfoDialog',
linkTo: '/components/dialogs/info-dialog',
linkTo: '/components/info-dialog',
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 think it's better to keep a flat URL structure

@emmenko emmenko force-pushed the nm-website-info-dialog-page branch from 3afb1e6 to fff8f2e Compare April 27, 2019 12:58
// 'Spectral:400,700',
// https://design.google/library/choosing-web-fonts-beginners-guide/
// 'Libre+Baskerville:400,400i,700',
'Raleway:400,400i,700,700i',
Copy link
Member Author

Choose a reason for hiding this comment

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

This is used for the typography content.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

image

Copy link
Contributor

Choose a reason for hiding this comment

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

FYI we do use REM in UI-Kit, so it respects the base HTML font size...

},
},
{
resolve: `gatsby-plugin-favicon`,
Copy link
Member Author

Choose a reason for hiding this comment

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

This plugin generates the favicons (using a webpack plugin) based on the svg logo

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 think we might actually use that for solving #257

@@ -4,23 +4,17 @@ import Highlight, { defaultProps } from 'prism-react-renderer';
import { customProperties } from '@commercetools-frontend/ui-kit';
import * as colors from '../colors';

// TODO: improve colors
const theme = {
Copy link
Member Author

Choose a reason for hiding this comment

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

The changes in the theme colors are based on the github theme from prism-react-renderer

<span key={key} {...getTokenProps({ token, key })} />
))}
{line.map((token, key) => {
if (tokens.length === i + 1 && token.empty) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is to avoid rendering an empty line at the end of the code block

`;

// Typography sizes have been calculated from https://type-scale.com
// Ref: https://medium.com/sketch-app-sources/exploring-responsive-type-scales-cf1da541be54
Copy link
Member Author

Choose a reason for hiding this comment

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

👆Where I based the font sizes from

<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 34.3 39"><style>.st0{fill:rgb(212,4,36);} .st1{fill:rgb(242, 182, 191);} .st2{fill:rgb(16, 28, 40);} .st3{fill:rgb(159, 201, 249);}</style><g id="XMLID_1_"><path id="XMLID_75_" class="st0" d="M1.4 29.2c-.2.1-.4.4-.4.7 0 .3.2.6.4.7l14.9 7c.2.1.4.1.6.1V22.1c-.2 0-.4 0-.7.1l-14.8 7z"/><path id="XMLID_74_" class="st1" d="M17 22.1v15.6c.2 0 .5 0 .7-.1l14.9-7c.3-.1.4-.4.4-.7 0-.3-.2-.6-.4-.7l-14.9-6.9c-.3-.1-.5-.2-.7-.2z"/><path id="XMLID_73_" class="st2" d="M1 8.8c0 .3.2.6.4.7l14.9 7c.2.1.4.1.6.1.2 0 .4 0 .6-.1.1-.1.1-.1.4-.2 1.5-.7.5-.2 14.6-6.8.3-.1.5-.4.5-.7 0-.3-.2-.6-.4-.7l-15-7c-.4-.2-.9-.2-1.3 0l-14.9 7c-.2.1-.4.4-.4.7z"/><path id="XMLID_72_" class="st3" d="M17 17.5v4.6c-.2 0-.4 0-.7.1l-14.9 7c-.2.1-.4.4-.4.7V9.3v-.5c0 .3.2.6.4.7l14.9 7c.2.1.4.1.6.1.2 0 .4 0 .6-.1-.4.2-.5.4-.5 1z"/></g></svg>
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 just changed the fill colors. It now looks like this

image

@emmenko emmenko added the 🙏 Status: Dev Review Waiting for technical reviews label Apr 27, 2019
@emmenko emmenko requested a review from montezume April 27, 2019 13:06
@emmenko
Copy link
Member Author

emmenko commented Apr 27, 2019

Some of the build errors should be fixed with #574

@emmenko emmenko force-pushed the nm-website-info-dialog-page branch from fff8f2e to 0c01867 Compare April 29, 2019 09:44
);
const rowHeaders = tableHeaders.props.children;
return React.Children.toArray(rowHeaders.props.children).reduce(
(styles, elem, index) => `
Copy link
Contributor

Choose a reason for hiding this comment

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

😮

<GitHubSvg />
</a>
<MenuButton onClick={props.toggleMenu}>
<BurgerIcon isActive={props.isMenuOpen} />
Copy link
Member Author

Choose a reason for hiding this comment

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

The "burger menu" is visible on small screens

2019-04-29 14 25 30

Copy link
Contributor

Choose a reason for hiding this comment

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

those pink underlines look weird. Shouldn't they be more inline-block than block? 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

That looks pretty nice :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Screen Shot 2019-04-29 at 2 28 43 PM

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, don't worry about that. I still need to go through the visual things with design.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually that was easy to fix 7a08005

Copy link
Member Author

Choose a reason for hiding this comment

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

image

return React.Children.toArray(rowHeaders.props.children).reduce(
(styles, elem, index) => `
${styles}
td:nth-of-type(${index + 1}):before { content: "${
Copy link
Member Author

Choose a reason for hiding this comment

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

On small screens the table becomes a block list (see https://flaviocopes.com/css-responsive-table/).

This logic here is to extract the table headers and inject them into each row cell.

2019-04-29 14 27 26

@@ -2,10 +2,13 @@
export const light = {
Copy link
Member Author

Choose a reason for hiding this comment

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

The names here are still WIP, I'll clean that up when we finalize the layout

table: props => (
<div
css={css`
overflow: auto;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is to help "seeing" the table in case the responsive breakpoint hasn't kicked in yet and the table cannot reduce its size anymore

2019-04-29 14 35 14

@emmenko emmenko requested review from tdeekens and montezume April 29, 2019 12:37
@emmenko
Copy link
Member Author

emmenko commented Apr 29, 2019

Alright, I think from my side this PR is ready for review.

The main goal is to style the markdown pages and to make the layout somehow responsive.

Copy link
Contributor

@tdeekens tdeekens left a comment

Choose a reason for hiding this comment

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

Code looks good to me. I think it's important to get things started and then see where the wonky bits are and improve :)

@emmenko emmenko merged commit f6102b0 into master Apr 29, 2019
@emmenko emmenko deleted the nm-website-info-dialog-page branch April 29, 2019 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙏 Status: Dev Review Waiting for technical reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants