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
389f2ee3
Commit
389f2ee3
authored
Apr 25, 2020
by
zarina
🌊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#6
, добавлена возможность удаления цитат
parent
0674d7b8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
Quote.js
src/components/Quote/Quote.js
+1
-1
Quotes.js
src/containers/Quotes/Quotes.js
+15
-0
No files found.
src/components/Quote/Quote.js
View file @
389f2ee3
...
...
@@ -9,7 +9,7 @@ const Quote = props => {
<
CardBody
>
<
CardTitle
className
=
'text-uppercase font-weight-bold'
>
{
props
.
author
}
<
/CardTitle
>
<
CardText
>
{
props
.
text
}
<
/CardText
>
<
Button
className
=
'mr-3'
color
=
'danger'
>
Delete
<
/Button
>
<
Button
onClick
=
{
props
.
delete
}
className
=
'mr-3'
color
=
'danger'
>
Delete
<
/Button
>
<
Button
color
=
'info'
>
Edit
<
/Button
>
<
/CardBody
>
<
CardFooter
className
=
'text-muted'
>
{
props
.
category
}
<
/CardFooter
>
...
...
src/containers/Quotes/Quotes.js
View file @
389f2ee3
...
...
@@ -22,16 +22,31 @@ const Quotes = props => {
,
[
props
.
match
.
params
.
category
]);
const
deleteQuote
=
(
id
)
=>
{
axios
.
delete
(
`/quotes/
${
id
}
.json`
)
.
then
(()
=>
{
let
allQuotes
=
{...
quotes
};
delete
allQuotes
[
id
];
setQuotes
(
allQuotes
)
})
}
const
printQuotes
=
()
=>
{
return
Object
.
keys
(
quotes
).
map
(
quote
=>
{
return
<
Quote
author
=
{
quotes
[
quote
].
author
}
text
=
{
quotes
[
quote
].
text
}
category
=
{
quotes
[
quote
].
category
}
key
=
{
quote
}
delete
=
{()
=>
deleteQuote
(
quote
)}
/
>
})
};
return
(
<
div
className
=
'Quotes'
>
{
...
...
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