forked from polka_billy/porridger
Hackathon finished
This commit is contained in:
10
front/src/App.css
Normal file
10
front/src/App.css
Normal file
@ -0,0 +1,10 @@
|
||||
body {
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
color: white;
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
.modal-content, .form-select {
|
||||
background-color: rgb(17, 17, 17) !important;
|
||||
}
|
30
front/src/App.jsx
Normal file
30
front/src/App.jsx
Normal file
@ -0,0 +1,30 @@
|
||||
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom'
|
||||
|
||||
import { HomePage, AddPage, LoginPage, UserPage } from './pages'
|
||||
|
||||
import WithToken from './components/WithToken'
|
||||
|
||||
import './App.css'
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<Router>
|
||||
<Routes>
|
||||
<Route index element={<HomePage />} />
|
||||
<Route path="/add" element={
|
||||
<WithToken>
|
||||
<AddPage />
|
||||
</WithToken>
|
||||
} />
|
||||
<Route path="/user" element={
|
||||
<WithToken>
|
||||
<UserPage />
|
||||
</WithToken>
|
||||
} />
|
||||
<Route path="/login" element={<LoginPage />} />
|
||||
</Routes>
|
||||
</Router>
|
||||
)
|
||||
}
|
||||
|
||||
export default App
|
1
front/src/assets/addIcon.svg
Normal file
1
front/src/assets/addIcon.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" style="fill: rgb(17, 17, 17); --darkreader-inline-fill: #e8e6e3;" data-darkreader-inline-fill=""><path d="M20 2H4c-1.103 0-2 .897-2 2v18l4-4h14c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2zm-3 9h-4v4h-2v-4H7V9h4V5h2v4h4v2z"></path></svg>
|
After Width: | Height: | Size: 315 B |
32
front/src/assets/category.js
Normal file
32
front/src/assets/category.js
Normal file
@ -0,0 +1,32 @@
|
||||
const categoryGraphics = new Map([
|
||||
["PORRIDGE", "static/PORRIDGE.jpg"],
|
||||
["conspects", "static/conspects.jpg"],
|
||||
["milk", "static/milk.jpg"],
|
||||
["bred", "static/bred.jpg"],
|
||||
["wathing", "static/wathing.jpg"],
|
||||
["cloth", "static/cloth.jpg"],
|
||||
["fruits_vegatables", "static/fruits_vegatables.jpg"],
|
||||
["soup", "static/soup.jpg"],
|
||||
["dinner", "static/dinner.jpg"],
|
||||
["conserves", "static/conserves.jpg"],
|
||||
["pens", "static/pens.jpg"],
|
||||
["other_things", "static/other_things.jpg"]
|
||||
|
||||
])
|
||||
|
||||
const categoryNames = new Map([
|
||||
["PORRIDGE", "PORRIDGE"],
|
||||
["conspects", "Конспекты"],
|
||||
["milk", "Молочные продукты"],
|
||||
["bred", "Хлебобулочные изделия"],
|
||||
["wathing", "Моющие средства"],
|
||||
["cloth", "Одежда"],
|
||||
["fruits_vegatables", "Фрукты и овощи"],
|
||||
["soup", "Супы"],
|
||||
["dinner", "Ужин"],
|
||||
["conserves", "Консервы"],
|
||||
["pens", "Канцелярия"],
|
||||
["other_things", "Всякая всячина"]
|
||||
])
|
||||
|
||||
export { categoryNames, categoryGraphics }
|
1
front/src/assets/filterIcon.svg
Normal file
1
front/src/assets/filterIcon.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" style="fill: rgb(17, 17, 17); --darkreader-inline-fill: #e8e6e3;" data-darkreader-inline-fill=""><path d="M13 20v-4.586L20.414 8c.375-.375.586-.884.586-1.415V4a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v2.585c0 .531.211 1.04.586 1.415L11 15.414V22l2-2z"></path></svg>
|
After Width: | Height: | Size: 337 B |
1
front/src/assets/handIcon.svg
Normal file
1
front/src/assets/handIcon.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" style="fill: rgb(17, 17, 17); --darkreader-inline-fill: #e8e6e3;" data-darkreader-inline-fill=""><path d="M20.5 5A1.5 1.5 0 0 0 19 6.5V11h-1V4.5a1.5 1.5 0 0 0-3 0V11h-1V3.5a1.5 1.5 0 0 0-3 0V11h-1V5.5a1.5 1.5 0 0 0-3 0v10.81l-2.22-3.6a1.5 1.5 0 0 0-2.56 1.58l3.31 5.34A5 5 0 0 0 9.78 22H17a5 5 0 0 0 5-5V6.5A1.5 1.5 0 0 0 20.5 5z"></path></svg>
|
After Width: | Height: | Size: 427 B |
11
front/src/assets/licence.txt
Normal file
11
front/src/assets/licence.txt
Normal file
@ -0,0 +1,11 @@
|
||||
License
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2021 Aniket Suvarna
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
6
front/src/assets/metro.js
Normal file
6
front/src/assets/metro.js
Normal file
@ -0,0 +1,6 @@
|
||||
const metros = [
|
||||
"Петроградская",
|
||||
"Горьковская"
|
||||
]
|
||||
|
||||
export { metros }
|
1
front/src/assets/userIcon.svg
Normal file
1
front/src/assets/userIcon.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" style="fill: rgb(17, 17, 17); --darkreader-inline-fill: #e8e6e3;" data-darkreader-inline-fill=""><path d="M7.5 6.5C7.5 8.981 9.519 11 12 11s4.5-2.019 4.5-4.5S14.481 2 12 2 7.5 4.019 7.5 6.5zM20 21h1v-1c0-3.859-3.141-7-7-7h-4c-3.86 0-7 3.141-7 7v1h17z"></path></svg>
|
After Width: | Height: | Size: 348 B |
54
front/src/components/AnnouncementDetails.jsx
Normal file
54
front/src/components/AnnouncementDetails.jsx
Normal file
@ -0,0 +1,54 @@
|
||||
import Modal from 'react-bootstrap/Modal'
|
||||
|
||||
import { categoryNames } from '../assets/category'
|
||||
import { MapContainer, Marker, Popup, TileLayer } from 'react-leaflet'
|
||||
import { Button } from 'react-bootstrap'
|
||||
import useBook from '../utils/useBook'
|
||||
|
||||
function AnnouncementDetails({ close, announcement: { id, name, category, bestBy, description, lat, lng, address, metro } }) {
|
||||
const handleBook = useBook(id)
|
||||
|
||||
return (
|
||||
<div
|
||||
className="modal show"
|
||||
style={{ display: 'flex', position: 'initial', alignItems: "center" }}
|
||||
>
|
||||
<Modal.Dialog>
|
||||
<Modal.Header closeButton onHide={close}>
|
||||
<Modal.Title>
|
||||
Подробнее
|
||||
</Modal.Title>
|
||||
</Modal.Header>
|
||||
|
||||
<Modal.Body>
|
||||
<h1>{name}</h1>
|
||||
|
||||
<span>{categoryNames.get(category)}</span>
|
||||
<span className='m-2'>•</span> {/* dot */}
|
||||
<span>Годен до {new Date(bestBy).toLocaleString('ru-RU')}</span>
|
||||
|
||||
<p className='mb-2'>{description}</p>
|
||||
|
||||
<MapContainer style={{ width: "100%", minHeight: 300 }} center={[lat, lng]} zoom={16} >
|
||||
<TileLayer
|
||||
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||
/>
|
||||
|
||||
<Marker position={[lat, lng]}>
|
||||
<Popup>{address + "\n" + metro}</Popup>
|
||||
</Marker>
|
||||
</MapContainer>
|
||||
</Modal.Body>
|
||||
|
||||
<Modal.Footer>
|
||||
<Button variant='success' onClick={handleBook}>
|
||||
Забронировать
|
||||
</Button>
|
||||
</Modal.Footer>
|
||||
</Modal.Dialog>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default AnnouncementDetails
|
50
front/src/components/BottomNavBar.jsx
Normal file
50
front/src/components/BottomNavBar.jsx
Normal file
@ -0,0 +1,50 @@
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
import addIcon from '../assets/addIcon.svg'
|
||||
import filterIcon from '../assets/filterIcon.svg'
|
||||
import userIcon from '../assets/userIcon.svg'
|
||||
|
||||
const navBarStyles = {
|
||||
backgroundColor: 'var(--bs-success)',
|
||||
height: 56,
|
||||
width: "100%",
|
||||
}
|
||||
|
||||
const navBarGroupStyles = {
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
height: "100%",
|
||||
margin: "auto"
|
||||
}
|
||||
|
||||
const navBarElementStyles = {
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center"
|
||||
}
|
||||
|
||||
function BottomNavBar({ width, toggleFilters }) {
|
||||
return (
|
||||
<div style={navBarStyles}>
|
||||
<div style={{ ...navBarGroupStyles, width: width }}>
|
||||
|
||||
<a style={navBarElementStyles} onClick={() => toggleFilters(true)}>
|
||||
<img src={filterIcon} alt="Фильтровать объявления" title='Фильтровать объявления' />
|
||||
</a>
|
||||
|
||||
<Link style={navBarElementStyles} to="/add" >
|
||||
<img src={addIcon} alt="Опубликовать объявление" title='Опубликовать объявление' />
|
||||
</Link>
|
||||
|
||||
<Link style={navBarElementStyles} to={"/user"} >
|
||||
<img src={userIcon} alt="Личный кабинет" title='Личный кабинет' />
|
||||
</Link>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default BottomNavBar
|
74
front/src/components/Filters.jsx
Normal file
74
front/src/components/Filters.jsx
Normal file
@ -0,0 +1,74 @@
|
||||
import { Button, Form, Modal } from "react-bootstrap"
|
||||
|
||||
import { categoryNames } from "../assets/category"
|
||||
import { metros } from '../assets/metro'
|
||||
|
||||
function Filters({ filter, setFilter, filterShown, setFilterShown }) {
|
||||
|
||||
const handleSubmit = (event) => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
const formData = new FormData(event.currentTarget)
|
||||
|
||||
setFilter(prev => ({
|
||||
...prev,
|
||||
category: formData.get("category") || null,
|
||||
metro: formData.get("metro") || null
|
||||
}))
|
||||
|
||||
setFilterShown(false)
|
||||
}
|
||||
|
||||
return (
|
||||
<Modal show={filterShown} onHide={() => setFilterShown(false)} centered>
|
||||
<Modal.Header closeButton>
|
||||
<Modal.Title>
|
||||
Фильтрация
|
||||
</Modal.Title>
|
||||
</Modal.Header>
|
||||
|
||||
<Modal.Body>
|
||||
<Form onSubmit={handleSubmit}>
|
||||
<Form.Group className="mb-3" controlId="categoryFilter">
|
||||
<Form.Label>
|
||||
Категория
|
||||
</Form.Label>
|
||||
|
||||
<Form.Select name="category" defaultValue={filter.category || undefined}>
|
||||
<option value="">
|
||||
Выберите категорию
|
||||
</option>
|
||||
{Array.from(categoryNames).map(
|
||||
([category, categoryName]) =>
|
||||
<option key={category} value={category}>{categoryName}</option>
|
||||
)}
|
||||
</Form.Select>
|
||||
</Form.Group>
|
||||
|
||||
<Form.Group className="mb-3" controlId="metroFilter">
|
||||
<Form.Label>
|
||||
Станция метро
|
||||
</Form.Label>
|
||||
|
||||
<Form.Select name="metro" defaultValue={filter.metro || undefined}>
|
||||
<option value="">
|
||||
Выберите станцию метро
|
||||
</option>
|
||||
{metros.map(
|
||||
(metro) =>
|
||||
<option key={metro} value={metro}>{metro}</option>
|
||||
)}
|
||||
</Form.Select>
|
||||
</Form.Group>
|
||||
|
||||
<Button variant="success" type="submit">
|
||||
Отправить
|
||||
</Button>
|
||||
</Form>
|
||||
</Modal.Body>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
|
||||
export default Filters
|
19
front/src/components/WithToken.jsx
Normal file
19
front/src/components/WithToken.jsx
Normal file
@ -0,0 +1,19 @@
|
||||
import { useEffect } from "react"
|
||||
import { getToken } from "../utils/auth"
|
||||
import { useNavigate } from "react-router-dom"
|
||||
|
||||
function WithToken({ children }) {
|
||||
const navigate = useNavigate()
|
||||
|
||||
useEffect(() => {
|
||||
if (!getToken()) {
|
||||
return navigate("/login")
|
||||
}
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<>{children}</>
|
||||
)
|
||||
}
|
||||
|
||||
export default WithToken
|
3
front/src/config.js
Normal file
3
front/src/config.js
Normal file
@ -0,0 +1,3 @@
|
||||
const API_URL = "api"
|
||||
|
||||
export { API_URL }
|
5
front/src/index.css
Normal file
5
front/src/index.css
Normal file
@ -0,0 +1,5 @@
|
||||
* {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
}
|
12
front/src/main.jsx
Normal file
12
front/src/main.jsx
Normal file
@ -0,0 +1,12 @@
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
|
||||
import App from './App.jsx'
|
||||
|
||||
import './index.css'
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
)
|
8
front/src/pages/AddPage.jsx
Normal file
8
front/src/pages/AddPage.jsx
Normal file
@ -0,0 +1,8 @@
|
||||
function AddPage() {
|
||||
|
||||
// TODO
|
||||
|
||||
return <></>
|
||||
}
|
||||
|
||||
export default AddPage
|
101
front/src/pages/HomePage.jsx
Normal file
101
front/src/pages/HomePage.jsx
Normal file
@ -0,0 +1,101 @@
|
||||
import Stories from 'react-insta-stories'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import BottomNavBar from '../components/BottomNavBar'
|
||||
import useStoryDimensions from '../utils/useStoryDimensions'
|
||||
|
||||
import { API_URL } from '../config'
|
||||
|
||||
import "./leafletStyles.css"
|
||||
import 'leaflet/dist/leaflet.css'
|
||||
|
||||
import AnnouncementDetails from '../components/AnnouncementDetails'
|
||||
import { categoryGraphics } from '../assets/category'
|
||||
import Filters from '../components/Filters'
|
||||
import { removeNull } from '../utils'
|
||||
|
||||
function generateStories(announcements) {
|
||||
return announcements.map(announcement => {
|
||||
return ({
|
||||
id: announcement.id,
|
||||
url: announcement.src || categoryGraphics.get(announcement.category),
|
||||
type: announcement.src?.endsWith("mp4") ? "video" : undefined,
|
||||
seeMore: ({ close }) => <AnnouncementDetails close={close} announcement={announcement} />
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const mock = [
|
||||
{
|
||||
id: 5,
|
||||
name: "Огурец",
|
||||
category: "fruits_vegatables",
|
||||
src: null,
|
||||
bestBy: 10000,
|
||||
description: "Очень вкусный огурец, прям, закачаешься",
|
||||
lat: 59.9724,
|
||||
lng: 30.3227,
|
||||
address: "ул. Профессора Попова, дом 5 литера Ф",
|
||||
metro: "Петроградская"
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
name: "Арбуз",
|
||||
category: "soup",
|
||||
src: "https://samplelib.com/lib/preview/mp4/sample-5s.mp4",
|
||||
bestBy: 20000,
|
||||
description: "Очень вкусный арбуз, прям, закачаешься",
|
||||
lat: 60.9724,
|
||||
lng: 30.3227,
|
||||
address: "ул. Профессора Попова, дом 50 литера Ф",
|
||||
metro: "Горьковская"
|
||||
}
|
||||
]
|
||||
|
||||
const defaultFilters = { userId: null, category: null, metro: null, bookedBy: null }
|
||||
|
||||
const PROD = true
|
||||
|
||||
function HomePage() {
|
||||
const { height, width } = useStoryDimensions(16 / 10)
|
||||
|
||||
const [announcements, setAnnouncements] = useState([])
|
||||
|
||||
const [filterShown, setFilterShown] = useState(false)
|
||||
|
||||
const [filter, setFilter] = useState(defaultFilters)
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
try {
|
||||
const res = PROD ? await fetch(API_URL + "/announcements?" + new URLSearchParams(removeNull(filter))) : null
|
||||
|
||||
const json = PROD ? (await res.json()).list_of_announcements : mock
|
||||
|
||||
setAnnouncements(json)
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
})()
|
||||
}, [filter])
|
||||
|
||||
const toggleFilters = (toggle) => setFilterShown(toggle)
|
||||
|
||||
return (<>
|
||||
<Filters filter={filter} setFilter={setFilter} filterShown={filterShown} setFilterShown={setFilterShown} />
|
||||
<div style={{ display: "flex", justifyContent: "center", backgroundColor: "rgb(17, 17, 17)" }}>
|
||||
{announcements.length && <Stories
|
||||
stories={generateStories(announcements)}
|
||||
defaultInterval={11000}
|
||||
height={height}
|
||||
width={width}
|
||||
loop={true}
|
||||
keyboardNavigation={true}
|
||||
/>}
|
||||
</div>
|
||||
<BottomNavBar toggleFilters={toggleFilters} width={width} />
|
||||
</>)
|
||||
}
|
||||
|
||||
export default HomePage
|
5
front/src/pages/LoginPage.jsx
Normal file
5
front/src/pages/LoginPage.jsx
Normal file
@ -0,0 +1,5 @@
|
||||
function LoginPage() {
|
||||
return <></>
|
||||
}
|
||||
|
||||
export default LoginPage
|
7
front/src/pages/UserPage.jsx
Normal file
7
front/src/pages/UserPage.jsx
Normal file
@ -0,0 +1,7 @@
|
||||
function UserPage() {
|
||||
/* TODO */
|
||||
|
||||
return <></>
|
||||
}
|
||||
|
||||
export default UserPage
|
4
front/src/pages/index.js
Normal file
4
front/src/pages/index.js
Normal file
@ -0,0 +1,4 @@
|
||||
export { default as HomePage } from './HomePage'
|
||||
export { default as AddPage } from './AddPage'
|
||||
export { default as LoginPage } from './LoginPage'
|
||||
export { default as UserPage } from './UserPage'
|
5
front/src/pages/leafletStyles.css
Normal file
5
front/src/pages/leafletStyles.css
Normal file
@ -0,0 +1,5 @@
|
||||
/* В связи со сложившейся политической обстановкой */
|
||||
.leaflet-attribution-flag {
|
||||
position: absolute;
|
||||
right: -100px;
|
||||
}
|
9
front/src/utils/auth.js
Normal file
9
front/src/utils/auth.js
Normal file
@ -0,0 +1,9 @@
|
||||
const getToken = () => {
|
||||
const token = localStorage.getItem("Token")
|
||||
|
||||
/* check expirity */
|
||||
|
||||
return token
|
||||
}
|
||||
|
||||
export { getToken }
|
10
front/src/utils/index.js
Normal file
10
front/src/utils/index.js
Normal file
@ -0,0 +1,10 @@
|
||||
const removeNull = (obj) => Object.fromEntries(
|
||||
Object.entries(obj)
|
||||
.filter(([_, value]) => value != null)
|
||||
.map(([key, value]) => [
|
||||
key,
|
||||
value === Object(value) ? removeNull(value) : value,
|
||||
]),
|
||||
);
|
||||
|
||||
export { removeNull }
|
18
front/src/utils/useBook.js
Normal file
18
front/src/utils/useBook.js
Normal file
@ -0,0 +1,18 @@
|
||||
import { useNavigate } from "react-router-dom"
|
||||
import { getToken } from "./auth"
|
||||
|
||||
function useBook(id) {
|
||||
const navigate = useNavigate()
|
||||
|
||||
const handleBook = () => {
|
||||
/* TODO */
|
||||
|
||||
if (!getToken()) {
|
||||
return navigate("/login")
|
||||
}
|
||||
}
|
||||
|
||||
return handleBook
|
||||
}
|
||||
|
||||
export default useBook
|
34
front/src/utils/useStoryDimensions.js
Normal file
34
front/src/utils/useStoryDimensions.js
Normal file
@ -0,0 +1,34 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
function getWindowDimensions() {
|
||||
const { innerWidth: width, innerHeight: height } = window;
|
||||
|
||||
return {
|
||||
width,
|
||||
height
|
||||
};
|
||||
}
|
||||
|
||||
function useStoryDimensions(maxRatio = 16/9) {
|
||||
const [windowDimensions, setWindowDimensions] = useState(getWindowDimensions())
|
||||
|
||||
useEffect(() => {
|
||||
function handleResize() {
|
||||
setWindowDimensions(getWindowDimensions());
|
||||
}
|
||||
|
||||
window.addEventListener("resize", handleResize);
|
||||
return () => window.removeEventListener("resize", handleResize);
|
||||
}, []);
|
||||
|
||||
const height = windowDimensions.height - 56
|
||||
|
||||
const ratio = Math.max(maxRatio, height / windowDimensions.width)
|
||||
|
||||
return {
|
||||
height: height,
|
||||
width: Math.round(height / ratio)
|
||||
}
|
||||
}
|
||||
|
||||
export default useStoryDimensions
|
Reference in New Issue
Block a user