Improve buttons for edit form
This commit is contained in:
parent
4c00c19bf8
commit
b8136bba01
|
@ -3,6 +3,8 @@ const theme = {
|
||||||
lead: "#043b14",
|
lead: "#043b14",
|
||||||
secondary: "#FFAD00",
|
secondary: "#FFAD00",
|
||||||
gray: "#c8c8c8",
|
gray: "#c8c8c8",
|
||||||
|
green:"#1fe651",
|
||||||
|
red:"#e64055"
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,12 @@ import {
|
||||||
TextField,
|
TextField,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
} from "qpa-components"
|
} from "qpa-components"
|
||||||
|
import css from "@emotion/css"
|
||||||
|
import { useTheme } from "qpa-emotion"
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import styled from "@emotion/styled"
|
import styled from "@emotion/styled"
|
||||||
import { hot } from "react-hot-loader"
|
import { hot } from "react-hot-loader"
|
||||||
import {EventPublishedState, EventStatus} from "../../../@types"
|
import { EventPublishedState, EventStatus } from "../../../@types"
|
||||||
import * as intl from "react-intl-universal"
|
import * as intl from "react-intl-universal"
|
||||||
import TagSelector from "../EventTags/TagsSelector"
|
import TagSelector from "../EventTags/TagsSelector"
|
||||||
import messages from "./EventForm.msg.json"
|
import messages from "./EventForm.msg.json"
|
||||||
|
@ -62,7 +64,7 @@ const EventForm = (props: Props) => {
|
||||||
"en-GB": messages.en,
|
"en-GB": messages.en,
|
||||||
})
|
})
|
||||||
const isEdit = !!props.values
|
const isEdit = !!props.values
|
||||||
|
const theme = useTheme()
|
||||||
const isEventOverMultipleDays =
|
const isEventOverMultipleDays =
|
||||||
props.values &&
|
props.values &&
|
||||||
props.values.time &&
|
props.values.time &&
|
||||||
|
@ -107,7 +109,7 @@ const EventForm = (props: Props) => {
|
||||||
},
|
},
|
||||||
tagNames: [],
|
tagNames: [],
|
||||||
status: "confirmed",
|
status: "confirmed",
|
||||||
publishedState: "published"
|
publishedState: "published",
|
||||||
} as EventFormData)
|
} as EventFormData)
|
||||||
}
|
}
|
||||||
validate={(values: EventFormData) => {
|
validate={(values: EventFormData) => {
|
||||||
|
@ -300,14 +302,25 @@ const EventForm = (props: Props) => {
|
||||||
)}
|
)}
|
||||||
</Field>
|
</Field>
|
||||||
<Footer>
|
<Footer>
|
||||||
<Button type="submit" loading={props.loading} disabled={!isValid} color="green">
|
<Button
|
||||||
|
type="submit"
|
||||||
|
loading={props.loading}
|
||||||
|
disabled={!isValid}
|
||||||
|
color="primary"
|
||||||
|
>
|
||||||
{isEdit ? intl.get("save-changes") : intl.get("CREATE")}
|
{isEdit ? intl.get("save-changes") : intl.get("CREATE")}
|
||||||
</Button>
|
</Button>
|
||||||
{props.onDeleteEvent ? (
|
{props.onDeleteEvent ? (
|
||||||
<DeleteButton
|
<DeleteButton
|
||||||
type="button"
|
type="button"
|
||||||
|
color="inherit"
|
||||||
onClick={props.onDeleteEvent}
|
onClick={props.onDeleteEvent}
|
||||||
loading={props.deleteEventLoading}
|
loading={props.deleteEventLoading}
|
||||||
|
css={css`
|
||||||
|
&& {
|
||||||
|
background-color: ${theme.colors.red};
|
||||||
|
}
|
||||||
|
`}
|
||||||
>
|
>
|
||||||
{intl.get("DELETE")}
|
{intl.get("DELETE")}
|
||||||
</DeleteButton>
|
</DeleteButton>
|
||||||
|
@ -362,6 +375,9 @@ const Footer = styled.div`
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
margin-top: 14px;
|
margin-top: 14px;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
> *:not(:last-of-type) {
|
||||||
|
margin-right: 24px;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const StyledNextOccurrencesPreview = styled(NextOccurrencesPreview)`
|
const StyledNextOccurrencesPreview = styled(NextOccurrencesPreview)`
|
||||||
|
|
Loading…
Reference in New Issue