Skip to content

Commit de92f9d

Browse files
committed
style(make findable): popover style & animation
1 parent 9678f3e commit de92f9d

File tree

2 files changed

+66
-13
lines changed

2 files changed

+66
-13
lines changed

elements/src/components/pos-make-findable/pos-make-findable.css

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
button.main {
22
display: flex;
3+
transition: width 200ms;
34
flex-direction: row;
5+
overflow: hidden;
46
height: var(--size-8);
57
width: var(--size-8);
68
align-items: center;
@@ -14,17 +16,57 @@ button.main {
1416
padding: 0;
1517
margin: 0;
1618
display: none;
19+
white-space: nowrap;
20+
}
21+
}
22+
23+
.options {
24+
position: absolute;
25+
animation: fadeIn 300ms;
26+
padding: 0;
27+
margin-top: var(--size-1);
28+
z-index: var(--layer-top);
29+
30+
ol {
31+
display: flex;
32+
flex-direction: column;
33+
box-shadow: var(--shadow-md);
34+
backdrop-filter: var(--blur-md);
35+
border-radius: var(--radius-xs);
36+
overflow: hidden;
37+
background-color: var(--color-grey-200);
38+
padding: 0;
39+
margin: 0;
40+
list-style: none;
41+
button {
42+
transition: all 300ms var(--ease-in-out-sine);
43+
margin: 0;
44+
border: none;
45+
outline: none;
46+
padding: var(--size-2);
47+
width: var(--size-full);
48+
49+
&:hover {
50+
filter: brightness(80%);
51+
}
52+
53+
&:active {
54+
filter: brightness(90%);
55+
}
56+
}
1757
}
1858
}
1959

2060
svg {
2161
display: inline-block;
2262
height: var(--size-6);
63+
flex-shrink: 0;
64+
flex-grow: 0;
2365
width: var(--size-6);
2466
}
2567

2668
button.main:hover {
27-
width: auto;
69+
width: var(--size-full);
2870
height: var(--size-8);
2971
background: var(--color-grey-200);
3072
color: var(--color-grey-700);
@@ -33,3 +75,12 @@ button.main:hover {
3375
display: inline-block;
3476
}
3577
}
78+
79+
@keyframes fadeIn {
80+
0% {
81+
opacity: 0;
82+
}
83+
100% {
84+
opacity: 1;
85+
}
86+
}

elements/src/components/pos-make-findable/pos-make-findable.tsx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export class PosMakeFindable implements PodOsAware {
7575
if (!session.state.isLoggedIn) {
7676
return null;
7777
}
78+
7879
return (
7980
<Host>
8081
<button class="main" onClick={e => this.onClick(e)} title="">
@@ -84,7 +85,6 @@ export class PosMakeFindable implements PodOsAware {
8485
viewBox="0 0 24 24"
8586
stroke-width="1.5"
8687
stroke="currentColor"
87-
class="size-6"
8888
>
8989
<path
9090
stroke-linecap="round"
@@ -95,17 +95,19 @@ export class PosMakeFindable implements PodOsAware {
9595
<p>Make this findable</p>
9696
</button>
9797
{this.showOptions && (
98-
<ol role="listbox">
99-
{this.indexes.map((index: LabelIndex) => (
100-
<li role="option">
101-
<button onClick={e => this.chooseOption(e, index)}>
102-
<pos-resource uri={index.uri} lazy={true}>
103-
<pos-label></pos-label>
104-
</pos-resource>
105-
</button>
106-
</li>
107-
))}
108-
</ol>
98+
<div class="options">
99+
<ol role="listbox">
100+
{this.indexes.map((index: LabelIndex) => (
101+
<li role="option">
102+
<button onClick={e => this.chooseOption(e, index)}>
103+
<pos-resource uri={index.uri} lazy={true}>
104+
<pos-label></pos-label>
105+
</pos-resource>
106+
</button>
107+
</li>
108+
))}
109+
</ol>
110+
</div>
109111
)}
110112
</Host>
111113
);

0 commit comments

Comments
 (0)