-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
299 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react' | ||
import { Helmet } from 'react-helmet' | ||
import { Container, Title, Subtitle } from './styles' | ||
export const Layout = ({ children, title = '', subtitle = '' }) => { | ||
return ( | ||
<> | ||
<Helmet> | ||
<title>{`${title} | Petgram 🐕 `}</title> | ||
<meta name='description' content={subtitle} /> | ||
</Helmet> | ||
<Container> | ||
<Title>{title}</Title> | ||
<Subtitle>{subtitle}</Subtitle> | ||
{children} | ||
</Container> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import styled from 'styled-components' | ||
|
||
export const Container = styled.div` | ||
padding: 16px; | ||
` | ||
|
||
export const Title = styled.h1` | ||
font-size: 24px; | ||
font-weight: 600px; | ||
color: #222; | ||
padding-bottom: 8px; | ||
` | ||
|
||
export const Subtitle = styled.small` | ||
font-size: 14px; | ||
font-weight: 400px; | ||
color: #333; | ||
padding-bottom: 4px; | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
import React from 'react' | ||
import { Button } from './styles.js' | ||
import { PropTypes } from 'prop-types' | ||
export const SubmitButton = ({ children, disabled = false, onClick }) => { | ||
return ( | ||
<Button disabled={disabled} onClick={onClick}> | ||
{children} | ||
</Button> | ||
) | ||
} | ||
|
||
SubmitButton.propTypes = { | ||
children: PropTypes.node.isRequired, | ||
disabled: PropTypes.bool, | ||
onClick: PropTypes.func | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { useState, useEffect } from 'react' | ||
|
||
export const useCategoryData = () => { | ||
const [categories, setCategories] = useState([]) | ||
const [loading, setLoading] = useState(false) | ||
const [error, setError] = useState('') | ||
|
||
useEffect(() => { | ||
const getCategories = async () => { | ||
setLoading(true) | ||
try { | ||
const response = await window.fetch( | ||
'https://silnose-petgram-api.vercel.app/categories' | ||
) | ||
const data = await response.json() | ||
setCategories(data) | ||
setLoading(false) | ||
} catch (error) { | ||
setLoading(false) | ||
setError(error.message) | ||
} | ||
} | ||
getCategories() | ||
}, []) | ||
|
||
return { categories, loading, error } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
import React from 'react' | ||
import { PhotoDetail } from '../components/PhotoDetail/index' | ||
import { Layout } from '../components/Layout' | ||
import { PhotoDetail } from '../components/PhotoDetail' | ||
import { PropTypes } from 'prop-types' | ||
|
||
export const Detail = ({ detailId }) => { | ||
return <PhotoDetail id={detailId} /> | ||
const Detail = ({ detailId }) => { | ||
return ( | ||
<Layout title='More Details' subtitle='More Details of your pets'> | ||
<PhotoDetail id={detailId} /> | ||
</Layout> | ||
) | ||
} | ||
export default Detail | ||
|
||
Detail.propTypes = { | ||
id: PropTypes.number.isRequired | ||
} |
Oops, something went wrong.