Skip to content

Commit 3595c90

Browse files
committed
html and css 0xHabitat#65
1 parent 014c758 commit 3595c90

File tree

3 files changed

+212
-106
lines changed

3 files changed

+212
-106
lines changed

web/lib/HabitatCommunity.js

+17-26
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,13 @@ button, .button {
190190
display: none;
191191
padding-bottom: 1em;
192192
}
193-
#sticky {
194-
position: sticky;
195-
top: .5em;
196-
max-width: max-content;
197-
padding: .5em 1em;
198-
border-radius: 2em;
199-
background-color: var(--color-bg);
200-
border: 1px solid var(--color-bg-invert);
201-
z-index: 9;
193+
#t_cart {
194+
bottom: 26px;
195+
left: 0;
196+
right: 0;
197+
z-index: 100;
198+
position: absolute;
199+
display: flex;
202200
}
203201
#tabs * {
204202
outline: none;
@@ -320,27 +318,20 @@ button, .button {
320318
<div id='tabnav' class='flex row evenly'></div>
321319
<space></space>
322320
</div>
323-
324-
<space></space>
325-
326-
<div id='sticky' class='flex row center evenly'>
327-
<div class='flex row'>
328-
<habitat-toggle
329-
id='delegateModeToggle'
330-
left='Personal Mode'
331-
tooltip-left='Your personal voting power'
332-
right='Delegation Mode'
333-
tooltip-right='Voting power delegated to you'
334-
></habitat-toggle>
335-
<habitat-transaction-cart></habitat-transaction-cart>
336-
</div>
337-
</div>
338-
339321
<div id='tabs'></div>
340322
341323
</div>
342324
<space></space>
343325
</section>
326+
<habitat-transaction-cart id='t_cart'>
327+
<habitat-toggle
328+
id='delegateModeToggle'
329+
left='Personal Mode'
330+
tooltip-left='Your personal voting power'
331+
right='Delegation Mode'
332+
tooltip-right='Voting power delegated to you'
333+
></habitat-toggle>
334+
</habitat-transaction-cart>
344335
</div>
345336
</div>
346337
`;
@@ -694,4 +685,4 @@ button, .button {
694685
window.postMessage({ type: 'hbt-tx-bundle', value: batch }, window.location.origin);
695686
}
696687
}
697-
customElements.define('habitat-community', HabitatCommunity);
688+
customElements.define('habitat-community', HabitatCommunity);

web/lib/HabitatToggle.js

+24-12
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ const TEMPLATE = document.createElement('template');
22
TEMPLATE.innerHTML = `
33
<style>
44
* {
5-
color: var(--color-text);
6-
line-height: 1;
7-
vertical-align: bottom;
85
box-sizing: border-box;
96
}
107
#inner,
@@ -41,14 +38,19 @@ pin {
4138
background-color: var(--color-bg);
4239
transition: margin .2s ease-in;
4340
}
44-
#inner.on {
45-
background-color: var(--color-bg-invert);
46-
}
41+
// #inner.on {
42+
// background-color: var(--color-bg-invert);
43+
// }
4744
#inner.on > pin {
4845
margin-left: 1em;
4946
}
5047
#mode {
51-
margin: 0 .2em 0 .5em;
48+
margin: 0 .2em 2px 0;
49+
color: white;
50+
font-family: arial;
51+
font-style: normal;
52+
font-size: 14px;
53+
line-height: 18px;
5254
}
5355
#tooltip {
5456
display: block;
@@ -60,11 +62,11 @@ pin {
6062
align-self: start;
6163
background-color: var(--color-bg-invert);
6264
visibility: hidden;
65+
margin-top: -4px;
6366
}
6467
#tooltip > span {
6568
display: block;
6669
line-height: .9;
67-
color: var(--color-bg);
6870
}
6971
#tooltip > #content {
7072
display: none;
@@ -94,16 +96,26 @@ pin {
9496
}
9597
#wrapper {
9698
display: flex;
97-
flex-direction: row;
99+
flex-direction: column;
98100
align-items: center;
99101
}
102+
#top{
103+
display: flex;
104+
flex-direction: row;
105+
}
100106
</style>
107+
<div id='top'>
101108
<div id='wrapper'>
109+
<span id='mode'></span>
102110
<div id='inner'>
103111
<pin></pin>
104112
</div>
105-
<span id='mode'></span>
106-
<div id='tooltip'><span>ℹ</span><p id='content'> </p></div>
113+
</div>
114+
<div id='tooltip'>
115+
<svg width="8" height="8" viewBox="0 0 8 8" fill="none" xmlns="http://www.w3.org/2000/svg">
116+
<path d="M1.77778 0.00537109C0.791111 0.00537109 0 0.796482 0 1.78315V8.00537H1.77778H6.22222C7.20889 8.00537 8 7.21426 8 6.22759V1.78315C8 0.796482 7.20889 0.00537109 6.22222 0.00537109H1.77778ZM4 1.3387C4.48889 1.3387 4.88889 1.7387 4.88889 2.22759C4.88889 2.71648 4.48889 3.11648 4 3.11648C3.51111 3.11648 3.11111 2.71648 3.11111 2.22759C3.11111 1.7387 3.51111 1.3387 4 1.3387ZM3.55556 3.56093H4.44444C4.69333 3.56093 4.88889 3.75648 4.88889 4.00537V6.22759C4.88889 6.47648 4.69333 6.67204 4.44444 6.67204H3.55556C3.30667 6.67204 3.11111 6.47648 3.11111 6.22759V4.00537C3.11111 3.75648 3.30667 3.56093 3.55556 3.56093Z" fill="white"/>
117+
</svg>
118+
<p id='content'> </p></div>
107119
</div>
108120
`;
109121

@@ -152,4 +164,4 @@ class HabitatToggle extends HTMLElement {
152164
this.shadowRoot.querySelector('#content').innerHTML = tooltipText;
153165
}
154166
}
155-
customElements.define('habitat-toggle', HabitatToggle);
167+
customElements.define('habitat-toggle', HabitatToggle);

0 commit comments

Comments
 (0)