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

Restyle Add templates to doc pages and give docs home one #1335

Merged
merged 1 commit into from
May 22, 2020

Conversation

restyled-io[bot]
Copy link
Contributor

@restyled-io restyled-io bot commented May 22, 2020

Automated style fixes for #1268, created by Restyled.

The following restylers made fixes:

  • prettier

To incorporate these changes, merge this Pull Request into the original. We
recommend using the Squash or Rebase strategies.

NOTE: As work continues on the original Pull Request, this process will
re-run and update (force-push) this Pull Request with updated style fixes as
necessary. If the style is fixed manually at any point (i.e. this process finds
no fixes to make), this Pull Request will be closed automatically.

Sorry if this was unexpected. To disable it, see our documentation.

@shcheklein shcheklein temporarily deployed to dvc-landing-restyled-ne-ch5wnr May 22, 2020 04:00 Inactive
@shcheklein shcheklein merged commit f10b5aa into new-docs-home May 22, 2020
shcheklein added a commit that referenced this pull request May 22, 2020
* Add templates to doc pages and give docs home one

- Default docs page template moved from `src/templates/doc-home.tsx` to
  `src/templates/doc.tsx`. A new homepage-specific (but currently identical)
  template has been added in its place.

- Added frontmatter to docs home source to define the template

- Docs now have a "template" field, which when defined changes the component
  used to make its page. This is a file relative to `src/templates` with the
  extension left off. This defaults to `doc`, or the file
  `src/templates/doc.tsx`. This is not currently on blog posts.

* Add "card" and "cards" custom components to Docs

* Create some example content with the new custom card components

This is not intended to be final, but show off the general premise of
how using custom components for this kind of layout would look like.

The card and cards components are, on top of being fully stylable with CSS
modules, capable of using arbitrary Markdown images or elements as the card
"logo" when the `logo` prop is set to `true` (or anything truthy, like the
string `"true"`). This works around the complexity of working in custom image
capability by leaning on the one we already have in Markdown.

To make a card with a logo, set the "logo" prop to true and make sure the first
element in the card contains the image you want- this element will be set aside
in its own div, with the rest of the contents displayed beside it using `flex`

There are some quirks with Remark custom components, though:

- custom components aren't indented

- custom components must be contained to one line, including props.

- custom components can include Markdown, but there must be an empty line
  between the transition.

- self-closing tags aren't supported

Should we use custom components more often, we can migrate to MDX (I actually
already have a fully working branch with it that I made on my own time) which
handles this syntax much more comfortably because it's designed around the
concept. All our custom remark-based logic will cleanly port because MDX
actually uses Remark in its pipeline.

* Resolve TS issues in example

* Remove doc home template and example images

In an effort to make the current solution good enough to fit release, I've
removed the alternate template since this branch currently favors custom
components.

* Add example images to all home cards, and remove example heading.

* Remove images from cards in doc home content

* Improve Cards and add href feature.

Cards now accept a `href` prop, which turns the whole card into a link. This is
our Link wrapper, so we get the same automatic `rel` and `target` setting for
external links as well as Gatsby Link for internal ones.

This link spans the whole card, and has some styling to go along with it.
Currently the hover style is set to a slight grow animation, but it could be
anything.

Most of the `children`-modifying hackery has been removed in favor of wrapping
all Cards. This also brings a degree of consistency to Cards, and we can apply
indivual styles if the need arises. It's still needed for the Card Images,
however, since newlines that show up in `children` are mandatory for how
rehype's React and MD are separated.

* Change doc home content

- Make each Card a single link applied via the new `href` part

- Add headings to each card

- Remove card icons

* Change hover animation to background-color

Now they match the right side buttons, aside from the animated transition.

* index: simplify and update content

* Restyled by prettier (#1335)

Co-authored-by: Restyled.io <[email protected]>

* home page, get started - fix the link

* docs index - change oder, cards should go first

* home index: return use cases

* card style: less contrast for the heading

* docs home page: update cards text

Co-authored-by: Ivan Shcheklein <[email protected]>
Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com>
Co-authored-by: Restyled.io <[email protected]>
@shcheklein shcheklein deleted the restyled/new-docs-home branch June 30, 2020 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants