fix type
This commit is contained in:
parent
8e84411fa4
commit
bd6baa69a5
@ -1,12 +1,11 @@
|
|||||||
import { SeparatorWithAnchor } from '../../components';
|
import { SeparatorWithAnchor } from '../../components';
|
||||||
import data from '../../datas/home.json';
|
|
||||||
import news from '../../datas/recent_news_event.json';
|
import news from '../../datas/recent_news_event.json';
|
||||||
import popular from '../../datas/popular.json';
|
import popular from '../../datas/popular.json';
|
||||||
import critics_users_pick from '../../datas/critics_users_best_pick.json';
|
import critics_users_pick from '../../datas/critics_users_best_pick.json';
|
||||||
import popular_user_review from '../../datas/popular_user_reviews.json';
|
import popular_user_review from '../../datas/popular_user_reviews.json';
|
||||||
import './style.css';
|
import './style.css';
|
||||||
import { useEffect, useState } from 'preact/hooks';
|
import { useEffect, useState } from 'preact/hooks';
|
||||||
import { getListLocations, getListRecentLocationsRatings } from '../../services';
|
import { getListRecentLocationsRatingsService } from '../../services';
|
||||||
|
|
||||||
type NewPlaces = {
|
type NewPlaces = {
|
||||||
id: Number,
|
id: Number,
|
||||||
@ -28,12 +27,14 @@ type News = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Home() {
|
function Home() {
|
||||||
const [recentLocations, setRecentLocations] = useState([])
|
const [recentLocations, setRecentLocations] = useState<Array<NewPlaces>>([])
|
||||||
|
// const [isLoading, setIsLoading] = useState<boolean>(true)
|
||||||
|
|
||||||
async function getRecentLocations() {
|
async function getRecentLocations() {
|
||||||
try {
|
try {
|
||||||
const locations = await getListRecentLocationsRatings(12)
|
const locations = await getListRecentLocationsRatingsService(12)
|
||||||
setRecentLocations(locations.data)
|
setRecentLocations(locations.data)
|
||||||
|
// setIsLoading(false)
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
@ -49,7 +50,7 @@ function Home() {
|
|||||||
{/* RECENTLY ADDED SECTION */}
|
{/* RECENTLY ADDED SECTION */}
|
||||||
<section about={"Recently added places"} className={'mt-3'}>
|
<section about={"Recently added places"} className={'mt-3'}>
|
||||||
<SeparatorWithAnchor pageLink='#' pageName='recently added' secondLink='#' />
|
<SeparatorWithAnchor pageLink='#' pageName='recently added' secondLink='#' />
|
||||||
{recentLocations.map((x: NewPlaces) => (
|
{recentLocations.map((x) => (
|
||||||
<div className={"recently-added-section-card"}>
|
<div className={"recently-added-section-card"}>
|
||||||
<div className={'border-secondary recently-img-container'}>
|
<div className={'border-secondary recently-img-container'}>
|
||||||
<img alt={x.name} src={x.thumbnail.String.toString()} loading="eager" style={{ width: '100%', height: '100%' }} />
|
<img alt={x.name} src={x.thumbnail.String.toString()} loading="eager" style={{ width: '100%', height: '100%' }} />
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
.main-content {
|
|
||||||
padding: 20px 25px;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.recently-added-section-card {
|
.recently-added-section-card {
|
||||||
padding: 10px 1% 15px;
|
padding: 10px 1% 15px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@ -59,12 +54,6 @@
|
|||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.users-score {
|
|
||||||
color: #a8adb3;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
line-height: 1.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.critics-users-rating-container {
|
.critics-users-rating-container {
|
||||||
margin-top: 0.75rem;
|
margin-top: 0.75rem;
|
||||||
}
|
}
|
||||||
@ -185,15 +174,4 @@
|
|||||||
height: 100px;
|
height: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.users-score {
|
|
||||||
font-size: .75rem;
|
|
||||||
line-height: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.users-score-bar p {
|
|
||||||
font-size: 0.75rem;;
|
|
||||||
line-height: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user