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

Solid Popover Component #476

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions _lib/_solid-components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
@import "solid-components/tags";
@import "solid-components/cards";
@import "solid-components/pagination";
@import "solid-components/popovers";
144 changes: 144 additions & 0 deletions _lib/solid-components/_popovers.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
//
// Popovers
// --------------------------------------------------
$background-caret-size: .625rem;
$foreground-caret-size: .5625rem;

Choose a reason for hiding this comment

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


.popover-right, .popover-left, .popover-bottom, .popover-top {
width: 100%;
position: relative;
padding: $space-2;

// shared styles between right, left, bottom, and top caret for the popover
&:before, &:after {
content: " ";
pointer-events: none;
position: absolute;
height: 0;
width: 0;
border: solid transparent;
right: 100%;
}
&:before { //foreground caret styles for right, left, bottom, & top popover
border-color: transparent;
border-width: $background-caret-size;
}
&:after { // background caret styles for right, left, bottom, & top popover
border-color: transparent;
border-width: $foreground-caret-size;
}
}

.popover-right, .popover-left {
&:before {
margin-top: -($background-caret-size); //foreground caret styles for right & left popover
}
&:after {
margin-top: -($foreground-caret-size); //background caret styles for between right & left popover
}
}

.popover-right {
&:before, &:after { // caret styles for the right popover
right: 100%;
top: 50%;
}
&:before {
border-right-color: lighten($fill-gray, 20%);
}
&:after {
border-right-color: $fill-white;
}
&--gray {
background-color: darken($fill-gray, 20%);
border: none;
color: white;
&:before {
border-right-color: darken($fill-gray, 20%);
}
&:after {
border-right-color: darken($fill-gray, 20%);
}
}
}

.popover-left {
&:before, &:after { // caret styles for the left popover
left: 100%;
top: 50%;
}
&:before {
border-left-color: lighten($fill-gray, 20%);
}
&:after {
border-left-color: $fill-white;
}
&--gray {
background-color: darken($fill-gray, 20%);
border: none;
color: white;
&:before {
border-left-color: darken($fill-gray, 20%);
}
&:after {
border-left-color: darken($fill-gray, 20%);
}
}
}

.popover-top, .popover-bottom {
&:before {
margin-left: -($background-caret-size); // foreground caret styles shared between top and bottom popover
}
&:after {
margin-left: -($foreground-caret-size); // background caret styles shared between top and bottom popover
}
}

.popover-top {
&:before, &:after { // caret styles for the top popover
left: 50%;
bottom: 100%;
}
&:before {
border-bottom-color: lighten($fill-gray, 20%);
}
&:after {
border-bottom-color: $fill-white;
}
&--gray {
background-color: darken($fill-gray, 20%);
border: none;
color: white;
&:before {
border-bottom-color: darken($fill-gray, 20%);
}
&:after {
border-bottom-color: darken($fill-gray, 20%);
}
}
}

.popover-bottom {
&:before, &:after { // caret styles for the bottom popover
left: 50%;
top: 100%;
}
&:before {
border-top-color: lighten($fill-gray, 20%);
}
&:after {
border-top-color: $fill-white;
}
&--gray {
background-color: darken($fill-gray, 20%);
border: none;
color: white;
&:before {
border-top-color: darken($fill-gray, 20%);
}
&:after {
border-top-color: darken($fill-gray, 20%);
}
}
}
6 changes: 5 additions & 1 deletion docs/_includes/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ <h1 class="xs-relative xs-py3 sm-py0 sm-mb4 solid-header">
{% endif %}

</li>

<li class="solid-nav__group {% if page.title == 'Tables' %}active{% endif %}">

<a class="xs-block xs-px2 xs-py2 sm-py1 bold solid-nav__item" href="tables.html">Tables</a>
Expand Down Expand Up @@ -302,6 +302,10 @@ <h1 class="xs-relative xs-py3 sm-py0 sm-mb4 solid-header">
<a class="xs-block xs-px2 xs-py2 sm-py1 bold solid-nav__item" href="tags.html">Tags</a>
</li>

<li class="solid-nav__group {% if page.title == 'Popovers' %}active{% endif %}">
<a class="xs-block xs-px2 xs-py2 sm-py1 bold solid-nav__item" href="popovers.html">Popovers</a>
</li>

</ol>

</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/main.css" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.5/styles/github.min.css">
<link rel="icon" type="image/png" href="/favicon.png">
<link rel="icon" type="image/png" href="/favicon.ico">
</head>
<body class="fill-gray-lighter">
{% include nav.html %}
Expand Down
File renamed without changes.
46 changes: 46 additions & 0 deletions docs/popovers.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
layout: default
title: Popovers
---

<section class="xs-mb6">

<a name="pagination"></a>
<h2 class="bold xs-mb2">Popovers</h2>
<p class="xs-mb2">Popovers are useful for uncovering helpful information or hints when using a product. Use the <span class="nowrap">.<code class="js-highlight">.popover .popover--right</code></span> classes to incorporate a popover into your project.</p>

Choose a reason for hiding this comment

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

Is it worth mentioning the grey variant here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gray*



<div class="flex xs-flex-column">
<div class="popover-right card xs-mb3">
<p>Cassoulet is a rich, slow-cooked casserole originating in the south of France, containing meat, pork skin and white beans. </p>
</div>
<div class="popover-right popover-right--gray card xs-mb3">
<p>Cassoulet is a rich, slow-cooked casserole originating in the south of France, containing meat, pork skin and white beans. </p>
</div>
<div class="popover-left card xs-mb3">
<p>Cassoulet is a rich, slow-cooked casserole originating in the south of France, containing meat, pork skin and white beans. </p>
</div>
<div class="popover-left popover-left--gray card xs-mb3">
<p>Cassoulet is a rich, slow-cooked casserole originating in the south of France, containing meat, pork skin and white beans. </p>
</div>
<div class="popover-top card xs-mb3">
<p>Cassoulet is a rich, slow-cooked casserole originating in the south of France, containing meat, pork skin and white beans. </p>
</div>
<div class="popover-top popover-top--gray card xs-mb3">
<p>Cassoulet is a rich, slow-cooked casserole originating in the south of France, containing meat, pork skin and white beans. </p>
</div>
<div class="popover-bottom card xs-mb3">
<p>Cassoulet is a rich, slow-cooked casserole originating in the south of France, containing meat, pork skin and white beans. </p>
</div>
<div class="popover-bottom popover-bottom--gray card xs-mb3">
<p>Cassoulet is a rich, slow-cooked casserole originating in the south of France, containing meat, pork skin and white beans. </p>
</div>
</div>

<div class="xs-mt2">
{% highlight html %}

{% endhighlight %}
</div>

</section>