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

feat(tile): accented tile CSS pattern demo #1721

Merged
merged 9 commits into from
Aug 7, 2024
89 changes: 89 additions & 0 deletions docs/patterns/tile/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: Tile
layout: layouts/pages/basic.njk
hasToc: true
order: 120
tags:
- pattern
importElements:
- rh-tile
- rh-cta
- rh-surface
- rh-code-block
---

<link rel="stylesheet" href="{{ '/assets/packages/@rhds/elements/elements/rh-table/rh-table-lightdom.css' | url }}">
<link rel="stylesheet" href="{{ '/styles/samp.css' | url }}">

<style>
.grid + rh-cta {
margin-block-start: var(--rh-space-lg, 16px);
}

rh-tile {
width: 320px;
}

rh-tile.accented-tile {
position: relative;
overflow: hidden;
border-radius: var(--rh-border-radius-default, 3px);
}

rh-tile.accented-tile::before {
content: '';
position: absolute;
z-index: 2;
display: block;
inset-block-start: 0;
inset-inline: 0;
border-block-start-color: var(--rh-color-brand-red-on-light, #ee0000);
border-block-start-width: var(--rh-border-width-lg, 3px);
border-block-start-style: solid;
pointer-events: none;
}
</style>

## Overview

Tiles are flexible layouts with clickable and contained surfaces.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe link "Tile" to the Title element page or add a CTA to it



## Accented tile

The accented tile pattern should be used to draw attention to a specifc tile or set of tiles. Be careful not to apply the accented tile pattern to all tiles within a page, otherwise the accent effect will be lost. After all, "if everything is special, then nothing is special."

<div id="rhds-help-grid" class="grid sm-two-columns">
<div class="sample">
<h3>Example</h3>
<uxdot-example width-adjustment="752px">
<rh-tile class="accented-tile">
<h2 slot="headline"><a href="#top">Link</a></h2>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</rh-tile>
</uxdot-example>
</div>
<div class="sample-code">
<h3>CSS</h3>
<rh-code-block>
<script type="text/css">rh-tile.accented-tile {
position: relative;
overflow: hidden;
border-radius: var(--rh-border-radius-default, 3px);
}
rh-tile.accented-tile::before {
content: '';
position: absolute;
z-index: 2;
display: block;
inset-block-start: 0;
inset-inline: 0;
border-block-start-color: var(--rh-color-brand-red-on-light, #ee0000);
border-block-start-width: var(--rh-border-width-lg, 3px);
border-block-start-style: solid;
pointer-events: none;
}</script>
</rh-code-block>
</div>
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a way to get the bottom of the code block (or the CTA) and image container to line up when they're next to each other?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe consider moving the CTA out of the grid

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@zeroedin I was thinking about this exact thing last night. Will do.

Copy link
Member

Choose a reason for hiding this comment

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

Also, prefer the <rh-cta href=

<rh-cta><a href="/elements/tile/demos/#demo-accented-tiles">View accented tile demo</a></rh-cta>
2 changes: 1 addition & 1 deletion docs/patterns/video-thumbnail/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Video thumbnail
order: 120
order: 130
hasToc: true
tags:
- pattern
Expand Down
66 changes: 66 additions & 0 deletions elements/rh-tile/demo/accented-tiles.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<rh-context-demo>
<rh-tile-group>
<rh-tile class="accented-tile">
<h2 slot="headline"><a href="#top">Link</a></h2>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</rh-tile>

<rh-tile class="accented-tile">
<h2 slot="headline"><a href="#top">Link 2</a></h2>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</rh-tile>

<rh-tile class="accented-tile">
<h2 slot="headline"><a href="#top">Link 2</a></h2>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</rh-tile>
</rh-tile-group>
</rh-context-demo>

<script type="module">
import '@rhds/elements/rh-tile/rh-tile.js';
import '@rhds/elements/lib/elements/rh-context-demo/rh-context-demo.js';
</script>

<link rel="stylesheet" href="../rh-tile-lightdom.css">

<style>
rh-context-demo::part(demo) {
display: flex;
align-items: top;
flex-wrap: wrap;
gap: var(--rh-space-2xl, 32px);
}

rh-tile-group {
display: flex;
align-items: top;
flex-wrap: wrap;
column-gap: var(--rh-space-2xl, 32px);
row-gap: var(--rh-space-2xl, 32px);
margin-inline-end: var(--rh-space-md, 8px);
}

rh-tile {
width: 320px;
}

rh-tile.accented-tile {
position: relative;
overflow: hidden;
border-radius: var(--rh-border-radius-default, 3px);
}

rh-tile.accented-tile::before {
content: '';
position: absolute;
z-index: 2;
display: block;
inset-block-start: 0;
inset-inline: 0;
border-block-start-color: var(--rh-color-brand-red-on-light, #ee0000);
border-block-start-width: var(--rh-border-width-lg, 3px);
border-block-start-style: solid;
pointer-events: none;
}
</style>
Loading