Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6e350f8
Added `Fixes #` into the PR template
agisilaos Oct 19, 2017
9e13c39
Make a checklist out of the 3 sentences
agisilaos Oct 19, 2017
478f764
Added a space between the # and the (
agisilaos Oct 19, 2017
5dbec5c
Merge pull request #374 from agisilaos/agis/prtemplate
jonrohan Oct 23, 2017
23e4fbc
Merge branch 'master' into dev
jonrohan Oct 24, 2017
ea3ed60
Init .Popover
brandonrosage Oct 26, 2017
17d1a9f
Stable CSS-only 'Popover' component
brandonrosage Oct 27, 2017
4500309
Refactored to include `.Popover-message`
brandonrosage Oct 27, 2017
a7a8a4f
STorybook menu naming revision
brandonrosage Oct 27, 2017
760ceb1
Tweak caret alignment to overlap border.
brandonrosage Oct 27, 2017
13bf797
make Popover positioning more flexible
brandonrosage Nov 2, 2017
d23ce98
Support for top, right, left, bottom caret orientations
brandonrosage Nov 3, 2017
529fdb6
build error fix
brandonrosage Nov 3, 2017
4c6e9f0
Addresses @broccolini's feedback
brandonrosage Nov 3, 2017
dc3ab87
Tweak caret alignment
brandonrosage Nov 6, 2017
d4e6313
Reconciling documentation differences from Style Guide
brandonrosage Nov 6, 2017
6ae4002
Addresses @broccolini's feedback
brandonrosage Nov 6, 2017
ee50150
add peer dependency for Box component
broccolini Nov 7, 2017
dac9464
add toc
broccolini Nov 7, 2017
15d89f3
missed a couple of spacers
broccolini Nov 7, 2017
06feed4
Merge branch 'release-10.0.0' into popover
broccolini Nov 7, 2017
f7a9309
missed a comma
broccolini Nov 7, 2017
4938e89
update year on license
broccolini Nov 7, 2017
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
Prev Previous commit
Next Next commit
Support for top, right, left, bottom caret orientations
  • Loading branch information
brandonrosage committed Nov 3, 2017
commit d23ce981aa1883c30c6a03bfe97a7c102f0fc950
69 changes: 46 additions & 23 deletions modules/primer-popover/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ status: Experimental
-->

### Basic example
Defaults to caret oriented top-center.

```html title="Center-aligned (default)"
```html title="Default (top-center)"
<div class="position-relative text-center">
<button class="btn btn-primary">UI</button>
Copy link
Contributor

Choose a reason for hiding this comment

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

Using a button here made me want to click on it to show/hide the popover because it kind of looks like a dropdown. Might be better to change this to a gray box with text along the lines of "New feature you want to draw attention to".

<div class="Popover">
<div class="Popover-message text-left p-4 mt-2 Box box-shadow-large">
<div class="Popover right-0 left-0">
<div class="Popover-message text-left p-4 mt-2 mx-auto Box box-shadow-large">
<h4 class="mb-2">Popover heading</h4>
<p>Message about this particular piece of UI.</p>
<button type="submit" class="btn btn-outline mt-2 text-bold">Got it!</button>
Expand All @@ -55,13 +56,13 @@ status: Experimental
</div>
```

### Right-aligned example
### Large example

```html title="Right-aligned"
<div class="position-relative text-right">
```html title="Large"
<div class="position-relative text-center">
<button class="btn btn-primary">UI</button>
<div class="Popover">
<div class="Popover-message Popover-message--right text-left p-4 mt-2 Box box-shadow-large">
<div class="Popover right-0 left-0">
<div class="Popover-message Popover-message--lg text-left p-4 mt-2 Box box-shadow-large">
<h4 class="mb-2">Popover heading</h4>
<p>Message about this particular piece of UI.</p>
<button type="submit" class="btn btn-outline mt-2 text-bold">Got it!</button>
Expand All @@ -70,13 +71,13 @@ status: Experimental
</div>
```

### Left-aligned example
### Top-right-aligned example

```html title="Left-aligned"
<div class="position-relative">
```html title="Top-right"
<div class="position-relative text-right">
<button class="btn btn-primary">UI</button>
<div class="Popover">
<div class="Popover-message Popover-message--left text-left p-4 mt-2 Box box-shadow-large">
<div class="Popover right-0">
<div class="Popover-message Popover-message--top--right text-left p-4 mt-2 Box box-shadow-large">
<h4 class="mb-2">Popover heading</h4>
<p>Message about this particular piece of UI.</p>
<button type="submit" class="btn btn-outline mt-2 text-bold">Got it!</button>
Expand All @@ -85,20 +86,42 @@ status: Experimental
</div>
```

### Large example
### Right-aligned example

```html title="Large"
<div class="position-relative text-center">
<button class="btn btn-primary">UI</button>
<div class="Popover">
<div class="Popover-message Popover-message--lg text-left p-4 mt-2 Box box-shadow-large">
<h4 class="mb-2">Popover heading</h4>
<p>Message about this particular piece of UI.</p>
<button type="submit" class="btn btn-outline mt-2 text-bold">Got it!</button>
</div>
```html title="Right"
<div class="Popover">
<div class="Popover-message Popover-message--right p-4 mt-2 Box box-shadow-large">
<h4 class="mb-2">Popover heading</h4>
<p>Message about this particular piece of UI.</p>
<button type="submit" class="btn btn-outline mt-2 text-bold">Got it!</button>
</div>
</div>
```

### Left-aligned example

```html title="Left"
<div class="Popover">
<div class="Popover-message Popover-message--left p-4 mt-2 Box box-shadow-large">
<h4 class="mb-2">Popover heading</h4>
<p>Message about this particular piece of UI.</p>
<button type="submit" class="btn btn-outline mt-2 text-bold">Got it!</button>
</div>
</div>
```

### Bottom-aligned example

```html title="Bottom"
<div class="Popover">
<div class="Popover-message Popover-message--bottom p-4 mt-2 mx-auto Box box-shadow-large">
<h4 class="mb-2">Popover heading</h4>
<p>Message about this particular piece of UI.</p>
<button type="submit" class="btn btn-outline mt-2 text-bold">Got it!</button>
</div>
</div>
```

<!-- %enddocs -->

## License
Expand Down
109 changes: 107 additions & 2 deletions modules/primer-popover/lib/popover.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,30 @@
}
}

.Popover-message--right {
// Bottom-oriented carets
.Popover-message--bottom,
.Popover-message--bottom--right,
.Popover-message--bottom--left {
&::before,
&::after {
top: auto;
border-bottom-color: transparent;
}

&::before {
bottom: -15px;
border-top-color: rgba(0, 0, 0, 0.15);
Copy link
Contributor

Choose a reason for hiding this comment

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

Use -$spacer-3 and $border-black-fade instead of the static values.

}

&::after {
bottom: -13px;
border-top-color: $bg-white;
}
}

// Top & Bottom: Right-oriented carets
.Popover-message--top--right,
.Popover-message--bottom--right {
right: -9px;
margin-right: 0;

Expand All @@ -52,7 +75,9 @@
}
}

.Popover-message--left {
// Top & Bottom: Left-oriented carets
.Popover-message--top--left,
.Popover-message--bottom--left {
left: -9px;
margin-left: 0;

Expand All @@ -67,6 +92,86 @@
}
}

// Right- & Left-oriented carets
.Popover-message--right,
.Popover-message--right--top,
.Popover-message--right--bottom,
.Popover-message--left,
.Popover-message--left--top,
.Popover-message--left--bottom {
&::before,
&::after {
top: 50%;
left: auto;
margin-left: 0;
border-bottom-color: transparent;
}

&::before {
margin-top: -9px;
}

&::after {
margin-top: -8px;
}
}

// Right-oriented carets
.Popover-message--right,
.Popover-message--right--top,
.Popover-message--right--bottom {
&::before {
right: -15px;
border-left-color: rgba(0, 0, 0, 0.15);
Copy link
Contributor

Choose a reason for hiding this comment

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

Use -$spacer-3 and $border-black-fade instead of the static values.

}

&::after {
right: -13px;
border-left-color: $bg-white;
}
}

// Left-oriented carets
.Popover-message--left,
.Popover-message--left--top,
.Popover-message--left--bottom {
&::before {
left: -15px;
border-right-color: rgba(0, 0, 0, 0.15);
Copy link
Contributor

Choose a reason for hiding this comment

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

Use -$spacer-3 and $border-black-fade instead of the static values.

}

&::after {
left: -13px;
border-right-color: $bg-white;
}
}

// Right & Left: Top-oriented carets
.Popover-message--right--top,
.Popover-message--left--top {
&::before,
&::after {
top: 20px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Use $spacer-4 instead of the static value.

}
}

// Right & Left: Bottom-oriented carets
.Popover-message--right--bottom,
.Popover-message--left--bottom {
&::before,
&::after {
top: auto;
}

&::before {
bottom: 20px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Use $spacer-4 instead of the static value.

}

&::after {
bottom: 21px;
}
}

.Popover-message--lg {
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this being used? In the docs it says it's a slightly larger option, but that's wrapped in a media query and not mentioned. If it's about the width and not the breakpoint, we should say --large. Also I'd prefer this was divisible by 8 as well—does it work at 320px?


@include breakpoint(sm) {
Expand Down