Compare commits
No commits in common. "0fe463e33a8662a278b5c6d94109dd4da7729a72" and "5d2dc9f7c583b782096ab31ad023c7f042e42988" have entirely different histories.
0fe463e33a
...
5d2dc9f7c5
5
@types/assets.d.ts
vendored
5
@types/assets.d.ts
vendored
@ -1,5 +0,0 @@
|
||||
declare module '*.png' {
|
||||
const imagePath: string;
|
||||
|
||||
export default imagePath;
|
||||
}
|
@ -1,45 +1,8 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React from 'react';
|
||||
import Heading from '../../components/heading';
|
||||
|
||||
const ListPage = (): React.ReactElement => {
|
||||
const [error, setError] = useState<string>(null);
|
||||
const [data, setData] = useState<Array<{ id: number; title: string; description: string }>>();
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
const handle = async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const res = await fetch('/api/list');
|
||||
const data = await res.json();
|
||||
if (res.ok) {
|
||||
setData(data);
|
||||
} else {
|
||||
setError(data.message);
|
||||
}
|
||||
} catch (e) {
|
||||
setError(e.message);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
handle();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Heading>List Page New</Heading>
|
||||
{isLoading && <div>Loading...</div>}
|
||||
{error && <div>Произошла ошибка</div>}
|
||||
{data?.map((item) => {
|
||||
return (
|
||||
<div key={item.id}>
|
||||
{item.id}: {item.title} - {item.description}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
);
|
||||
return <Heading>List Page New</Heading>;
|
||||
};
|
||||
|
||||
export default ListPage;
|
||||
|
@ -1,7 +1,6 @@
|
||||
import React from 'react';
|
||||
import { getNavigationValue } from '@brojs/cli';
|
||||
import { HeaderContainer, NavContainer, NavItem, NavLink } from './index.style';
|
||||
import Logo from './logo/logo';
|
||||
|
||||
const navigations: Array<{ name: string; href: string }> = [
|
||||
{
|
||||
@ -17,7 +16,6 @@ const navigations: Array<{ name: string; href: string }> = [
|
||||
const Header = (): React.ReactElement => {
|
||||
return (
|
||||
<HeaderContainer>
|
||||
<Logo />
|
||||
<NavContainer>
|
||||
{navigations.map((item) => {
|
||||
return (
|
||||
|
@ -1,10 +1,7 @@
|
||||
import styled from '@emotion/styled';
|
||||
import { NavLink as NavLinkBase } from 'react-router-dom';
|
||||
|
||||
export const HeaderContainer = styled('header')`
|
||||
display: flex;
|
||||
align-items: center;
|
||||
`;
|
||||
export const HeaderContainer = styled('header')``;
|
||||
|
||||
export const NavContainer = styled.nav`
|
||||
display: flex;
|
||||
|
@ -1,17 +0,0 @@
|
||||
import React from 'react';
|
||||
import styled from '@emotion/styled';
|
||||
import logoPng from './logo2.png';
|
||||
|
||||
const LogoStyled = styled.img`
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
padding: 8px;
|
||||
`;
|
||||
|
||||
// ${__webpack_public_path__}/remote-assets/logo.png
|
||||
|
||||
const Logo = () => {
|
||||
return <LogoStyled src={logoPng} alt={'logo'} />;
|
||||
};
|
||||
|
||||
export default Logo;
|
Binary file not shown.
Before Width: | Height: | Size: 90 KiB |
@ -1,12 +1,3 @@
|
||||
const router = require('express').Router();
|
||||
const listRouter = require('./list');
|
||||
|
||||
module.exports = router;
|
||||
|
||||
const delay =
|
||||
(ms = 1000) =>
|
||||
(req, res, next) => {
|
||||
setTimeout(next, ms);
|
||||
};
|
||||
|
||||
router.use(delay());
|
||||
router.use('/list', listRouter);
|
||||
|
@ -1,7 +0,0 @@
|
||||
[
|
||||
{ "id": 1, "title": "title", "description": "description" },
|
||||
{ "id": 2, "title": "title", "description": "description" },
|
||||
{ "id": 3, "title": "title", "description": "description" },
|
||||
{ "id": 4, "title": "title", "description": "description" },
|
||||
{ "id": 5, "title": "title", "description": "description" }
|
||||
]
|
@ -1,12 +0,0 @@
|
||||
const router = require('express').Router();
|
||||
|
||||
module.exports = router;
|
||||
|
||||
const data = require('./data/list.json');
|
||||
|
||||
router.get('/', (req, res) => {
|
||||
res.send(data);
|
||||
// res.status(500).send({
|
||||
// message: 'Internal server error'
|
||||
// });
|
||||
});
|
Loading…
Reference in New Issue
Block a user