Skip to content

Commit 8323875

Browse files
authored
Merge pull request #436 from ethereum/homeRef
Home ref
2 parents 7bb3713 + d874d50 commit 8323875

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

apps/remix-ide/src/app/ui/landing-page/landing-page.js

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ let css = csjs`
2929
flex-grow: 3;
3030
}
3131
.hpLogoContainer {
32-
margin:30px;
32+
margin: 30px;
3333
padding-right: 90px;
3434
}
3535
.mediaBadge {
@@ -44,12 +44,16 @@ let css = csjs`
4444
height: 10em;
4545
}
4646
.hpSections {
47-
min-width: 640px;
47+
}
48+
.rightPanel {
49+
right: 0;
50+
position: absolute;
51+
z-index: 1000;
4852
}
4953
.remixHomeMedia {
5054
overflow-y: auto;
5155
overflow-x: hidden;
52-
max-height: 570px;
56+
max-height: 720px;
5357
}
5458
.panels {
5559
box-shadow: 0px 0px 17px -7px;
@@ -107,6 +111,8 @@ export class LandingPage extends ViewPlugin {
107111
this.verticalIcons = verticalIcons
108112
this.gistHandler = new GistHandler()
109113
const themeQuality = globalRegistry.get('themeModule').api.currentTheme().quality
114+
window.addEventListener('resize', () => this.adjustMediaPanel())
115+
window.addEventListener('click', (e) => this.hideMediaPanel(e))
110116
this.twitterFrame = yo`
111117
<div class="px-2 ${css.media}">
112118
<a class="twitter-timeline"
@@ -153,12 +159,29 @@ export class LandingPage extends ViewPlugin {
153159
</div>
154160
</div>
155161
`
162+
this.adjustMediaPanel()
156163
globalRegistry.get('themeModule').api.events.on('themeChanged', (theme) => {
157164
console.log("theme is ", theme.quality)
158165
this.onThemeChanged(theme.quality)
159166
})
160167
}
161168

169+
adjustMediaPanel () {
170+
this.twitterPanel.style.maxHeight = Math.max(window.innerHeight - 150, 200) + 'px'
171+
this.mediumPanel.style.maxHeight = Math.max(window.innerHeight - 150, 200) + 'px'
172+
}
173+
174+
hideMediaPanel (e) {
175+
const mediaPanelsTitle = document.getElementById('remixIDEMediaPanelsTitle')
176+
const mediaPanels = document.getElementById('remixIDEMediaPanels')
177+
if (!mediaPanelsTitle.contains(e.target) && !mediaPanels.contains(e.target)) {
178+
this.mediumPanel.classList.remove('d-block')
179+
this.mediumPanel.classList.add('d-none')
180+
this.twitterPanel.classList.remove('d-block')
181+
this.twitterPanel.classList.add('d-none')
182+
}
183+
}
184+
162185
onThemeChanged (themeQuality) {
163186
console.log("themes in listener is", themeQuality)
164187
let twitterFrame = yo`
@@ -399,12 +422,12 @@ export class LandingPage extends ViewPlugin {
399422
</div>
400423
</div><!-- end of hpSections -->
401424
</div>
402-
<div class="d-flex flex-column">
403-
<div class="d-flex pr-2 py-2 align-self-end">
425+
<div class="d-flex flex-column ${css.rightPanel}">
426+
<div class="d-flex pr-2 py-2 align-self-end" id="remixIDEMediaPanelsTitle">
404427
${this.badgeTwitter}
405428
${this.badgeMedium}
406429
</div>
407-
<div class="mr-3 d-flex bg-light ${css.panels}">
430+
<div class="mr-3 d-flex bg-light ${css.panels}" id="remixIDEMediaPanels">
408431
${this.mediumPanel}
409432
${this.twitterPanel}
410433
</div>

0 commit comments

Comments
 (0)