Skip to content

Commit

Permalink
Add retrying text
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Dec 5, 2024
1 parent a0972f2 commit 04d5860
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
17 changes: 14 additions & 3 deletions packages/dnb-eufemia/src/extensions/forms/Form/Status/Status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import DataContext from '../../DataContext/Context'
import { useSharedState } from '../../../../shared/helpers/useSharedState'
import useMounted from '../../../../shared/helpers/useMounted'
import setStatus, { Status } from './setStatus'
import { Button, Flex, Section } from '../../../../components'
import {
Button,
Flex,
HeightAnimation,
Section,
} from '../../../../components'
import { HeightAnimationAllProps } from '../../../../components/HeightAnimation'
import { P } from '../../../../elements'
import { useTranslation } from '../../hooks'
Expand Down Expand Up @@ -37,7 +42,7 @@ function StatusContainer(props: Props) {

const translations = useTranslation()

const { id } = useContext(DataContext) || {}
const { id, formState } = useContext(DataContext) || {}

const { data } = useSharedState<{
activeStatus?: Status
Expand Down Expand Up @@ -120,7 +125,13 @@ function StatusContainer(props: Props) {
>
<Flex.Stack gap="large">
<MainHeading>{title ?? tr.title}</MainHeading>
<P>{description ?? tr.description}</P>
<HeightAnimation>
<P>
{formState === 'pending'
? tr.retryingText
: description ?? tr.description}
</P>
</HeightAnimation>
<Flex.Horizontal>
<Button variant="secondary" onClick={onCancelHandler}>
{cancelButton ?? tr.cancelButton}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ export default {
StatusError: {
title: 'Sorry, something went wrong',
description: 'Please try again or contact us.',
retryButton: 'Try again',
cancelButton: 'Back',
retryButton: 'Try again',
retryingText: 'Retrying...',
},
SectionViewContainer: {
editButton: 'Edit',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ export default {
title: 'Beklager, noe gikk galt',
description:
'Prov igjen eller ta kontakt med oss om feilen vedstår.',
retryButton: 'Prøv igjen',
cancelButton: 'Tilbake',
retryButton: 'Prøv igjen',
retryingText: 'Prøver på nytt...',
},
SectionViewContainer: {
editButton: 'Endre',
Expand Down

0 comments on commit 04d5860

Please sign in to comment.