-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3c056d
commit b35dad7
Showing
3 changed files
with
92 additions
and
55 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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
|
||
interface SuccessAlertProps { | ||
message: string; | ||
onClick: () => void; | ||
} | ||
|
||
const SuccessAlert = ({ message, onClick }: SuccessAlertProps) => { | ||
return ( | ||
<div className='my-2.5 px-2.5 py-1 border-green-500 bg-green-100 border-1 rounded-xl flex justify-between'> | ||
<p className='text-green-900 p-2'>{ message }</p> | ||
<button | ||
type="button" | ||
className="text-green-900" | ||
onClick={onClick} | ||
> | ||
x | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default SuccessAlert; |
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import {CatalogTitle} from '@/models/CatalogTitle'; | ||
import WarningLabel from '@/components/WarningLabel'; | ||
import {catalogDateStringToNorwegianDateString} from '@/utils/dateUtils'; | ||
import {Button} from '@nextui-org/button'; | ||
import {FaArrowAltCircleLeft, FaEdit} from 'react-icons/fa'; | ||
import React from 'react'; | ||
import {useRouter} from 'next/navigation'; | ||
|
||
interface TitleNotFoundProps { | ||
titleId: number; | ||
titleString?: string; | ||
catalogTitle?: CatalogTitle; | ||
} | ||
|
||
const TitleNotFound = ({titleId, titleString, catalogTitle}: TitleNotFoundProps) => { | ||
const router = useRouter(); | ||
|
||
return ( | ||
<> | ||
{titleString ? ( | ||
<div className='flex flex-col items-center'> | ||
<h1 className="top-title-style">{titleString}</h1> | ||
{catalogTitle && catalogTitle.endDate && ( | ||
<WarningLabel | ||
className="mt-2" | ||
text={`Denne avisen ble avsluttet ${catalogDateStringToNorwegianDateString(catalogTitle.endDate)}`} | ||
/> | ||
)} | ||
</div> | ||
) : ( | ||
<p>Henter tittel ...</p> | ||
)} | ||
|
||
<p className="mt-10 text-lg">Fant ikke kontakt- og utgivelsesinformasjon for denne tittelen. Ønsker du å | ||
legge til? </p> | ||
<div className="mt-12 flex justify-between max-w-3xl w-full self-center"> | ||
<Button | ||
type="button" | ||
size={'lg'} | ||
startContent={<FaArrowAltCircleLeft/>} | ||
className="abort-button-style" | ||
onClick={() => router.push('/')} | ||
> | ||
Tilbake | ||
</Button> | ||
<Button | ||
type="button" | ||
size={'lg'} | ||
className="edit-button-style" | ||
endContent={<FaEdit/>} | ||
onClick={() => router.push(`/${titleId}/create?title=${titleString}`)} | ||
> | ||
Legg til informasjon | ||
</Button> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default TitleNotFound; |