Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
E
exam_8
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zarina
exam_8
Commits
9b874f53
Commit
9b874f53
authored
Apr 25, 2020
by
zarina
🌊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#4
, Реализован вывод цитат по категориям
parent
b6b1b067
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
13 deletions
+22
-13
.gitignore
.gitignore
+1
-0
Quote.js
src/components/Quote/Quote.js
+4
-4
App.js
src/containers/App.js
+2
-1
QuoteForm.js
src/containers/QuoteForm/QuoteForm.js
+1
-1
Quotes.js
src/containers/Quotes/Quotes.js
+14
-7
No files found.
.gitignore
View file @
9b874f53
...
...
@@ -7,6 +7,7 @@
# testing
/coverage
.idea
# production
/build
...
...
src/components/Quote/Quote.js
View file @
9b874f53
import
React
from
'react'
;
import
{
Card
,
Button
,
Card
Header
,
Card
Footer
,
CardBody
,
import
{
Card
,
Button
,
CardFooter
,
CardBody
,
CardTitle
,
CardText
}
from
'reactstrap'
;
const
Quote
=
props
=>
{
...
...
@@ -7,12 +7,12 @@ const Quote = props => {
<
div
>
<
Card
>
<
CardBody
>
<
CardTitle
>
{
props
.
author
}
<
/CardTitle
>
<
CardTitle
className
=
'text-uppercase font-weight-bold'
>
{
props
.
author
}
<
/CardTitle
>
<
CardText
>
{
props
.
text
}
<
/CardText
>
<
Button
color
=
'danger'
>
Delete
<
/Button
>
<
Button
c
lassName
=
'mr-3'
c
olor
=
'danger'
>
Delete
<
/Button
>
<
Button
color
=
'info'
>
Edit
<
/Button
>
<
/CardBody
>
<
CardFooter
className
=
'text-
hide
'
>
{
props
.
category
}
<
/CardFooter
>
<
CardFooter
className
=
'text-
muted
'
>
{
props
.
category
}
<
/CardFooter
>
<
/Card
>
<
/div
>
);
...
...
src/containers/App.js
View file @
9b874f53
...
...
@@ -12,7 +12,8 @@ function App() {
<
Switch
>
<
Route
path
=
"/add-quote"
exact
component
=
{
QuoteForm
}
/
>
<
Route
path
=
"/"
exact
component
=
{
Quotes
}
/
>
<
Route
path
=
"/quotes/"
exact
component
=
{
Quotes
}
/
>
<
Route
path
=
"/quotes/:category"
exact
component
=
{
Quotes
}
/
>
<
/Switch
>
<
/Container
>
<
/
>
...
...
src/containers/QuoteForm/QuoteForm.js
View file @
9b874f53
...
...
@@ -7,7 +7,7 @@ import CATEGORIES from "../../quotes-categories";
const
QuoteForm
=
props
=>
{
const
[
quoteInfo
,
setQuoteInfo
]
=
useState
({
author
:
''
,
category
:
CATEGORIES
[
0
].
title
,
category
:
CATEGORIES
[
0
].
id
,
text
:
''
});
...
...
src/containers/Quotes/Quotes.js
View file @
9b874f53
...
...
@@ -2,17 +2,24 @@ import React, {useEffect, useState} from "react";
import
axios
from
'../../axios-quote'
import
Quote
from
"../../components/Quote/Quote"
;
const
Quotes
=
()
=>
{
const
Quotes
=
props
=>
{
const
[
quotes
,
setQuotes
]
=
useState
({});
useEffect
(()
=>
{
axios
.
get
(
'/quotes.json'
).
then
(
response
=>
{
setQuotes
(
response
.
data
)
}
)
},
[]);
axios
.
get
(
props
.
match
.
params
.
category
?
`/quotes.json?orderBy="category"&equalTo="
${
props
.
match
.
params
.
category
}
"`
:
'/quotes.json'
)
.
then
(
response
=>
{
setQuotes
(
response
.
data
)
})
.
catch
(
error
=>
{
console
.
log
(
error
)
})
}
,
[]);
const
printQuotes
=
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment