Skip to content

Commit

Permalink
Merge pull request #7 from AJRedDevil/responsive-ui
Browse files Browse the repository at this point in the history
Responsive ui
  • Loading branch information
AjanShrestha authored Jan 2, 2020
2 parents bf8ec2e + 347516c commit b8b5ab0
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 8 deletions.
7 changes: 6 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@
</div>
</form>
</div>
<img src="/src/images/main-image.jpg" alt="Explore the City" class="main-image">
<img src="/src/images/main-image.jpg"
srcset="/src/images/main-image-lg.jpg 1200w,
/src/images/main-image.jpg 900w,
/src/images/main-image-sm.jpg 480w"
alt="Explore the City"
class="main-image">
<div class="page-content">
<h5 class="text-center mdl-color-text--primary">Share your Moments</h5>
<div id="shared-moments"></div>
Expand Down
32 changes: 31 additions & 1 deletion public/src/css/feed.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
top: 56px;
background: white;
text-align: center;
display: none;
transform: translateY(100vh);
transition: transform 0.3s;
}

.main-image {
Expand All @@ -32,4 +33,33 @@

.shared-moment-card.mdl-card {
margin: 10px auto;
width: 60%;
}

@media (min-width: 600px) {
.shared-moment-card.mdl-card {
width: 60%;
}
}

@media (min-width: 1000px) {
.shared-moment-card.mdl-card {
width: 75%;
}
}

.shared-moment-card .mdl-card__title {
height: 140px;
}

@media (min-height: 700px) {
.shared-moment-card.mdl-card {
height: 160px;
}
}

@media (min-height: 1000px) {
.shared-moment-card.mdl-card {
height: 200px;
}
}
10 changes: 5 additions & 5 deletions public/src/js/feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ var closeCreatePostModalButton = document.querySelector(
var sharedMomentsArea = document.querySelector('#shared-moments');

function openCreatePostModal() {
createPostArea.style.display = 'block';
setTimeout(() => {
createPostArea.style.transform = 'translateY(0)';
}, 1);
if (deferredPrompt) {
deferredPrompt.prompt();

Expand All @@ -33,7 +35,7 @@ function openCreatePostModal() {
}

function closeCreatePostModal() {
createPostArea.style.display = 'none';
createPostArea.style.transform = 'translateY(100vh)';
}

shareImageButton.addEventListener('click', openCreatePostModal);
Expand All @@ -59,13 +61,11 @@ function clearCards() {

function createCard(data) {
var cardWrapper = document.createElement('div');
cardWrapper.className =
'shared-moment-card mdl-cardnep-aus.jpg mdl-shadow--2dp';
cardWrapper.className = 'shared-moment-card mdl-card mdl-shadow--2dp';
var cardTitle = document.createElement('div');
cardTitle.className = 'mdl-card__title';
cardTitle.style.backgroundImage = `url(${data.image})`;
cardTitle.style.backgroundSize = 'cover';
cardTitle.style.height = '180px';
cardWrapper.appendChild(cardTitle);
var cardTitleTextElement = document.createElement('h2');
cardTitleTextElement.className = 'mdl-card__title-text';
Expand Down
2 changes: 1 addition & 1 deletion public/sw.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
importScripts('/src/js/idb.js');
importScripts('/src/js/utility.js');

const CACHE_STATIC_NAME = 'static-v11';
const CACHE_STATIC_NAME = 'static-v13';
const CACHE_DYNAMIC_NAME = 'dynamic-v3';
const STATIC_FILES = [
'/',
Expand Down

0 comments on commit b8b5ab0

Please sign in to comment.