Skip to content

Commit

Permalink
Image bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
terrerox committed Feb 3, 2023
1 parent 09bfd15 commit fc1120e
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 116 deletions.
31 changes: 2 additions & 29 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,37 +1,10 @@
<script setup>
import Header from './components/Header.vue'
import Navbar from './components/Navbar.vue'
</script>

<template>
<Header />
<section class="section-navigation mb-4">
<div class="">
<nav class="navbar navbar-expand-lg navbar-light">
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<router-link to="/" class="nav-link" href="#">Inicio <span class="sr-only">(current)</span></router-link>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Próximamente</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Próximamente</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Próximamente</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Próximamente</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0 d-none">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
</div>
</section>
<Navbar />
<router-view></router-view>
</template>
4 changes: 2 additions & 2 deletions src/components/CategorySection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const sidePosts = [postOne, postTwo]
:key="post.slug"
>
<div class="post-media" @click="goToPost(post.slug)">
<img class="img-fluid" :src="post.instagramMediaUrl" />
<img class="img-fluid" :src="post.instagramThumbnailUrl" />
</div>
<div class="post-header">
<div class="post-supertitle">CATEGORY</div>
Expand All @@ -63,7 +63,7 @@ const sidePosts = [postOne, postTwo]
<div class="row">
<div class="col-auto">
<div class="post-media" @click="goToPost(post.slug)">
<img :src="post.instagramMediaUrl" width="100">
<img :src="post.instagramThumbnailUrl" width="100">
</div>
</div>
<div class="col">
Expand Down
10 changes: 9 additions & 1 deletion src/components/Header.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
<script setup>
const currentDate = new Date().toLocaleString('es', {
weekday: "long",
year: "numeric",
month: "long",
day: "numeric",
})
</script>
<template>
<header class="header py-1">
<div class="container">
Expand All @@ -6,7 +14,7 @@
<div class="row no-gutters">
<div class="col-6 col-lg-12">
<div class="font-weight-bold">
<i class="fa fa-calendar-o" aria-hidden="true"></i> Friday 15 Sep 2018
<i class="fa fa-calendar-o" aria-hidden="true"></i> {{ currentDate }}
</div>
</div>
<div class="col-6 col-lg-12">
Expand Down
35 changes: 0 additions & 35 deletions src/components/Layout.vue

This file was deleted.

26 changes: 26 additions & 0 deletions src/components/Navbar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<template>
<section class="section-navigation mb-4">
<nav class="navbar navbar-expand-lg navbar-light">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<router-link to="/" class="nav-link" href="#">Inicio <span class="sr-only">(current)</span></router-link>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Nacionales</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Extranjeras</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Deportes</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Curiosas</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Educación sexual</a>
</li>
</ul>
</nav>
</section>
</template>
31 changes: 0 additions & 31 deletions src/components/Post.vue

This file was deleted.

14 changes: 14 additions & 0 deletions src/components/Promotions/Advertisment.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script setup>
import { usePostStore } from '../../store/posts'
const advertisment = usePostStore().advertisment
</script>
<template>
<div class="mb-5 text-center bg-hard-light">
<div class="small" style="background-color: rgba(0,0,0,0.05)"><span
class="text-muted font-alegreya">ADVERTISMENT</span></div>
<div class="py-2">
<img :src="advertisment.image.url" class="img-fluid" />
</div>
</div>
</template>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { usePostStore } from '../store/posts'
import { usePostStore } from '../../store/posts'
const banner = usePostStore().banner
</script>
Expand All @@ -8,7 +8,8 @@ const banner = usePostStore().banner
<div class="container">
<div class="row py-4">
<div class="col text-center">
<img :src="banner.image.url" class="img-fluid" />
<img :src="banner.image.url" v-if="banner.image" class="img-fluid" />
<h3 v-else>Promocionate aquí</h3>
</div>
</div>
</div>
Expand Down
11 changes: 3 additions & 8 deletions src/components/RightSection.vue
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
<script setup>
import { usePostStore } from '../store/posts'
import { useRouter } from 'vue-router';
import Advertisment from './Promotions/Advertisment.vue';
const router = useRouter()
function goToPost(slug) {
router.push({ path: slug })
}
const postStore = usePostStore()
const advertisment = postStore.advertisment
const assignClass = (index) => {
return (index === 0 && 'mb-3') || (index === 1 && 'mb-3 pb-3 border-bottom') || ''
}
</script>
<template>
<div class="col-12 order-2 order-lg-3 col-sm-12 col-lg-5 col-xl-4 mb-3 mb-lg-0 ">
<div class="mb-5 text-center bg-hard-light">
<div class="small" style="background-color: rgba(0,0,0,0.05)"><span
class="text-muted font-alegreya">ADVERTISMENT</span></div>
<div class="py-2">
<img :src="advertisment.image.url" class="img-fluid" />
</div>
</div>
<Advertisment />
<div
class="post"
:class="assignClass(index)"
Expand Down
5 changes: 0 additions & 5 deletions src/components/Station.vue

This file was deleted.

32 changes: 31 additions & 1 deletion src/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export function assignPromotionSections(promotion) {
advertisment
}
}
export function assignArraySections(posts) {
export function assignArraySections(rawPosts) {
const posts = mapPosts(rawPosts)
const heroPosts = [],
leftPosts = [],
rightPosts = [],
Expand Down Expand Up @@ -84,4 +85,33 @@ export function assignArraySections(posts) {
mainPost
}
}

function mapPosts(posts) {
return posts.map(post => {
const {
datetime,
description,
id,
instagramMediaUrl,
instagramThumbnailUrl,
mediaType,
mediaUrl,
preview,
slug,
title,
} = post
return {
datetime,
description,
id,
instagramMediaUrl,
instagramThumbnailUrl: instagramThumbnailUrl || instagramMediaUrl,
mediaType,
mediaUrl,
preview,
slug,
title,
}
})
}

3 changes: 1 addition & 2 deletions src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import { ref, onMounted } from 'vue'
import { useRoute } from 'vue-router';
import { usePostStore } from '../store/posts'
import Hero from '../components/Hero.vue'
import Post from '../components/Post.vue'
import CenterSection from '../components/CenterSection.vue'
import LeftSection from '../components/LeftSection.vue'
import RightSection from '../components/RightSection.vue'
import PromotionBanner from '../components/PromotionBanner.vue'
import PromotionBanner from '../components/Promotions/PromotionBanner.vue'
import CategorySection from '../components/CategorySection.vue'
Expand Down

1 comment on commit fc1120e

@vercel
Copy link

@vercel vercel bot commented on fc1120e Feb 3, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.