Added TypeScript for frontend
Added type definitions for components, functions, data Added guards for network responses fixes #8
This commit is contained in:
55
front/src/components/BottomNavBar.tsx
Normal file
55
front/src/components/BottomNavBar.tsx
Normal file
@ -0,0 +1,55 @@
|
||||
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: React.CSSProperties = {
|
||||
backgroundColor: 'var(--bs-success)',
|
||||
height: 56,
|
||||
width: "100%",
|
||||
}
|
||||
|
||||
const navBarGroupStyles: React.CSSProperties = {
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
height: "100%",
|
||||
margin: "auto"
|
||||
}
|
||||
|
||||
const navBarElementStyles: React.CSSProperties = {
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center"
|
||||
}
|
||||
|
||||
type BottomNavBarProps = {
|
||||
width: number,
|
||||
toggleFilters: (p: boolean) => void
|
||||
}
|
||||
|
||||
function BottomNavBar({ width, toggleFilters }: BottomNavBarProps) {
|
||||
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
|
Reference in New Issue
Block a user