Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
retypos-server
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
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eterfund
retypos-server
Commits
c7de9f7a
Commit
c7de9f7a
authored
May 23, 2018
by
Георгий Попов
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Задача 12794] Добавил всплывающие подсказки к кнопкам принять и отклонить опечатку
parent
5e0e9969
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
6 deletions
+44
-6
index.jsx
cp/javascript/src/components/Typo/index.jsx
+44
-6
No files found.
cp/javascript/src/components/Typo/index.jsx
View file @
c7de9f7a
import
React
,
{
Component
}
from
'react'
;
import
{
Card
,
CardHeader
,
CardTitle
,
CardFooter
,
CardBody
,
CardText
}
from
'reactstrap'
import
{
Card
,
CardHeader
,
CardTitle
,
CardFooter
,
CardBody
,
CardText
,
Tooltip
}
from
'reactstrap'
import
'./style.css'
export
default
class
Typo
extends
Component
{
state
=
{
show
:
this
.
props
.
show
};
constructor
(
props
)
{
super
(
props
);
this
.
toggleDeclineTooltip
=
this
.
toggleDeclineTooltip
.
bind
(
this
);
this
.
toggleAcceptTooltip
=
this
.
toggleAcceptTooltip
.
bind
(
this
);
this
.
state
=
{
acceptTooltipOpen
:
false
,
declineTooltipOpen
:
false
};
}
/**
* Управляет отображением всплывающей подсказки для
* кнопки принятия исправления.
*/
toggleAcceptTooltip
()
{
this
.
setState
({
acceptTooltipOpen
:
!
this
.
state
.
acceptTooltipOpen
,
declineTooltipOpen
:
false
})
}
/**
* Управляет отображением всплывающей подсказки для
* кнопки отклонения исправления.
*/
toggleDeclineTooltip
()
{
this
.
setState
({
acceptTooltipOpen
:
false
,
declineTooltipOpen
:
!
this
.
state
.
declineTooltipOpen
})
}
render
()
{
const
{
typo
,
acceptCallback
,
declineCallback
,
show
}
=
this
.
props
;
...
...
@@ -39,8 +69,16 @@ export default class Typo extends Component {
<
div
className=
"card-buttons"
>
<
div
className=
"buttons-wrapper"
>
<
button
className=
"accept-button btn btn-warning"
onClick=
{
acceptCallback
}
>
Исправить
</
button
>
<
button
className=
"decline-button btn btn-danger"
onClick=
{
declineCallback
}
>
Отклонить
</
button
>
<
button
id=
"acceptTypo"
className=
"accept-button btn btn-warning"
onClick=
{
acceptCallback
}
>
Исправить
</
button
>
<
Tooltip
placement=
"left"
isOpen=
{
this
.
state
.
acceptTooltipOpen
}
target=
"acceptTypo"
toggle=
{
this
.
toggleAcceptTooltip
}
>
Опечатка будет автоматически исправлена
</
Tooltip
>
<
button
id=
"declineTypo"
className=
"decline-button btn btn-danger"
onClick=
{
declineCallback
}
>
Отклонить
</
button
>
<
Tooltip
placement=
"right"
isOpen=
{
this
.
state
.
declineTooltipOpen
}
target=
"declineTypo"
toggle=
{
this
.
toggleDeclineTooltip
}
>
Опечатка не будет исправлена автоматически
</
Tooltip
>
</
div
>
</
div
>
</
CardBody
>
...
...
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