@@ -3,27 +3,32 @@ import styled from "styled-components";
3
3
import Button from "../Button" ;
4
4
import Flex from "../Flex" ;
5
5
import Modal from "../Modal" ;
6
+ import { UseMutationResult } from "react-query/types/react" ;
7
+ import { ToggleSuspendResourceResponse } from "../../lib/api/core/core.pb" ;
6
8
7
9
export type Props = {
8
10
onCloseModal : Dispatch < SetStateAction < boolean > > ;
9
11
open : boolean ;
10
12
setSuspendMessage : Dispatch < SetStateAction < string > > ;
11
- suspend : any ;
13
+ suspend : UseMutationResult < ToggleSuspendResourceResponse > ;
12
14
suspendMessage : string ;
13
15
className ?: string ;
14
16
} ;
15
17
16
- const MessageModal = styled ( Modal ) `
17
- textarea {
18
- width: 100%;
19
- box-sizing: border-box;
20
- font-family: inherit;
21
- font-size: 100%;
22
- border-radius: ${ ( props ) => props . theme . spacing . xxs } ;
23
- resize: none;
24
- margin-bottom: ${ ( props ) => props . theme . spacing . base } ;
25
- }
26
- ` ;
18
+
19
+ const MessageTextarea = styled . textarea `
20
+ width: 100%;
21
+ box-sizing: border-box;
22
+ font-family: inherit;
23
+ font-size: 100%;
24
+ border-radius: ${ ( props ) => props . theme . spacing . xxs } ;
25
+ resize: none;
26
+ margin-bottom: ${ ( props ) => props . theme . spacing . base } ;
27
+ padding: ${ ( props ) => props . theme . spacing . xs } ;
28
+ &:focus {
29
+ outline: ${ ( props ) => props . theme . colors . primary } solid 2px;
30
+ }
31
+ `
27
32
28
33
function SuspendMessageModal ( {
29
34
className,
@@ -34,11 +39,12 @@ function SuspendMessageModal({
34
39
suspendMessage,
35
40
} : Props ) {
36
41
const closeHandler = ( ) => {
42
+ setSuspendMessage ( "" ) ;
37
43
onCloseModal ( false ) ;
38
44
} ;
39
45
const suspendHandler = ( ) => {
40
46
setSuspendMessage ( suspendMessage ) ;
41
- suspend . mutateAsync ( ) ;
47
+ suspend . mutateAsync ( { } ) ;
42
48
setSuspendMessage ( "" ) ;
43
49
onCloseModal ( false ) ;
44
50
} ;
@@ -47,11 +53,11 @@ function SuspendMessageModal({
47
53
48
54
const content = (
49
55
< >
50
- < textarea
56
+ < MessageTextarea
51
57
rows = { 5 }
52
58
value = { suspendMessage }
53
59
onChange = { ( ev ) => setSuspendMessage ( ev . target . value ) }
54
- > </ textarea >
60
+ > </ MessageTextarea >
55
61
< Flex wide end >
56
62
< Button onClick = { suspendHandler } color = "inherit" variant = "text" >
57
63
Suspend
@@ -61,7 +67,7 @@ function SuspendMessageModal({
61
67
) ;
62
68
63
69
return (
64
- < MessageModal
70
+ < Modal
65
71
open = { open }
66
72
onClose = { onClose }
67
73
title = "Suspend Reason"
0 commit comments