mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
hiding error message (#757)
This commit is contained in:
parent
af3bb86073
commit
0a3ec01248
@ -1,7 +1,7 @@
|
|||||||
import Alert from '../atoms/Alert'
|
import Alert from '../atoms/Alert'
|
||||||
import Button from '../atoms/Button'
|
import Button from '../atoms/Button'
|
||||||
import Loader from '../atoms/Loader'
|
import Loader from '../atoms/Loader'
|
||||||
import React, { ReactElement } from 'react'
|
import React, { ReactElement, useState, FormEvent } from 'react'
|
||||||
import styles from './MetadataFeedback.module.css'
|
import styles from './MetadataFeedback.module.css'
|
||||||
import SuccessConfetti from '../atoms/SuccessConfetti'
|
import SuccessConfetti from '../atoms/SuccessConfetti'
|
||||||
|
|
||||||
@ -55,13 +55,24 @@ export default function MetadataFeedback({
|
|||||||
successAction: Action
|
successAction: Action
|
||||||
setError: (error: string) => void
|
setError: (error: string) => void
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
|
const [moreInfo, setMoreInfo] = useState<boolean>(false)
|
||||||
|
|
||||||
|
function toggleMoreInfo(e: FormEvent<Element>) {
|
||||||
|
e.preventDefault()
|
||||||
|
moreInfo === true ? setMoreInfo(false) : setMoreInfo(true)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.feedback}>
|
<div className={styles.feedback}>
|
||||||
<div className={styles.box}>
|
<div className={styles.box}>
|
||||||
<h3>{title}</h3>
|
<h3>{title}</h3>
|
||||||
{error ? (
|
{error ? (
|
||||||
<>
|
<>
|
||||||
<Alert text={error} state="error" />
|
<p>Sorry, something went wrong. Please try again.</p>
|
||||||
|
{moreInfo && <Alert text={error} state="error" />}
|
||||||
|
<Button style="text" size="small" onClick={toggleMoreInfo}>
|
||||||
|
{moreInfo === false ? 'More Info' : 'Hide error'}
|
||||||
|
</Button>
|
||||||
<ActionError setError={setError} />
|
<ActionError setError={setError} />
|
||||||
</>
|
</>
|
||||||
) : success ? (
|
) : success ? (
|
||||||
|
Loading…
Reference in New Issue
Block a user