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

fix(www): responsive ui of buttons on blog page #24152

Merged
Merged
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
54 changes: 34 additions & 20 deletions www/src/templates/tags.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/** @jsx jsx */
import { jsx } from "theme-ui"
import React from "react"
import styled from "@emotion/styled"
import { mediaQueries } from "gatsby-design-tokens/dist/theme-gatsbyjs-org"
import { graphql } from "gatsby"
import { TiTags as TagsIcon, TiArrowRight } from "react-icons/ti"

Expand All @@ -23,6 +25,16 @@ const preferSpacedTag = tags => {
return tags[0]
}

const ButtonWrapper = styled.div`
display: flex;
flex-direction: column;
align-items: flex-start;

${mediaQueries.xs} {
flex-direction: row;
}
`

const Tags = ({ pageContext, data }) => {
const { tags } = pageContext
const { nodes, totalCount } = data.allMdx
Expand All @@ -40,26 +52,28 @@ const Tags = ({ pageContext, data }) => {
)}`}
/>
<h1>{tagHeader}</h1>
<Button
variant="small"
key="blog-post-view-all-tags-button"
to="/blog/tags"
>
View all tags <TagsIcon />
</Button>
{doc ? (
<React.Fragment>
<span css={{ margin: 5 }} />
<Button
variant="small"
secondary
key={`view-tag-docs-button`}
to={doc}
>
Read the documentation <TiArrowRight />
</Button>
</React.Fragment>
) : null}
<ButtonWrapper>
<Button
variant="small"
key="blog-post-view-all-tags-button"
to="/blog/tags"
>
View all tags <TagsIcon />
</Button>
{doc ? (
<React.Fragment>
<span css={{ margin: 5 }} />
<Button
variant="small"
secondary
key={`view-tag-docs-button`}
to={doc}
>
Read the documentation <TiArrowRight />
</Button>
</React.Fragment>
) : null}
</ButtonWrapper>
{nodes.map(node => (
<BlogPostPreviewItem
post={node}
Expand Down