-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(j-s): Display case info in header (#16759)
* Remove console.log * Refactor * Refactoring * Refactoring --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
e47d2b9
commit 9685529
Showing
40 changed files
with
170 additions
and
274 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
apps/judicial-system/web/src/components/OverviewHeader/OverviewHeader.tsx
This file was deleted.
Oops, something went wrong.
72 changes: 63 additions & 9 deletions
72
apps/judicial-system/web/src/components/PageTitle/PageTitle.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,67 @@ | ||
import { FC, PropsWithChildren } from 'react' | ||
import { FC, PropsWithChildren, useContext } from 'react' | ||
import { useIntl } from 'react-intl' | ||
import { useRouter } from 'next/router' | ||
|
||
import { Box, Text } from '@island.is/island-ui/core' | ||
import { | ||
Box, | ||
Button, | ||
ResponsiveProp, | ||
Space, | ||
Text, | ||
} from '@island.is/island-ui/core' | ||
import { | ||
isCompletedCase, | ||
isIndictmentCase, | ||
} from '@island.is/judicial-system/types' | ||
import { core } from '@island.is/judicial-system-web/messages' | ||
|
||
const PageTitle: FC<PropsWithChildren> = ({ children }) => ( | ||
<Box marginBottom={7}> | ||
<Text as="h1" variant="h1"> | ||
{children} | ||
</Text> | ||
</Box> | ||
) | ||
import { FormContext } from '../FormProvider/FormProvider' | ||
import TagCaseState from '../TagCaseState/TagCaseState' | ||
|
||
interface Props { | ||
marginBottom?: ResponsiveProp<Space> | ||
previousUrl?: string | ||
} | ||
|
||
const PageTitle: FC<PropsWithChildren<Props>> = (props) => { | ||
const { marginBottom, previousUrl, children } = props | ||
const { workingCase } = useContext(FormContext) | ||
const { formatMessage } = useIntl() | ||
const router = useRouter() | ||
|
||
return ( | ||
<Box | ||
marginBottom={marginBottom ?? 7} | ||
display="flex" | ||
justifyContent="spaceBetween" | ||
> | ||
<Box> | ||
{previousUrl && ( | ||
<Box marginBottom={2}> | ||
<Button | ||
variant="text" | ||
preTextIcon="arrowBack" | ||
onClick={() => router.push(previousUrl)} | ||
> | ||
{formatMessage(core.back)} | ||
</Button> | ||
</Box> | ||
)} | ||
<Text as="h1" variant="h1"> | ||
{children} | ||
</Text> | ||
</Box> | ||
{isIndictmentCase(workingCase.type) && | ||
workingCase.indictmentRulingDecision && | ||
isCompletedCase(workingCase.state) && ( | ||
<TagCaseState | ||
caseState={workingCase.state} | ||
caseType={workingCase.type} | ||
indictmentRulingDecision={workingCase.indictmentRulingDecision} | ||
/> | ||
)} | ||
</Box> | ||
) | ||
} | ||
|
||
export default PageTitle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.