-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
8 changed files
with
148 additions
and
16 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
16 changes: 8 additions & 8 deletions
16
apps/service-catalog/app/catalogs/[catalogId]/public-services/new/page.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,13 @@ | ||
import { FormFieldCard } from '@catalog-frontend/ui'; | ||
import { Params } from 'next/dist/shared/lib/router/utils/route-matcher'; | ||
import ServiceForm from '../../../../components/service-form'; | ||
import { Heading } from '@digdir/design-system-react'; | ||
|
||
export default async function NewPublicServicePage() { | ||
export default async function NewPublicServicePage({ params }: Params) { | ||
const { catalogId } = params; | ||
return ( | ||
<div> | ||
<h1>Opprett ny offentlig tjeneste</h1> | ||
<FormFieldCard | ||
title='test' | ||
subtitle='tyeye' | ||
></FormFieldCard> | ||
<div className='container'> | ||
<Heading size='medium'>Informasjon om tjenesten</Heading> | ||
<ServiceForm catalogId={catalogId} /> | ||
</div> | ||
); | ||
} |
87 changes: 87 additions & 0 deletions
87
apps/service-catalog/app/components/service-form/index.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 |
---|---|---|
@@ -0,0 +1,87 @@ | ||
'use client'; | ||
|
||
import { Tag, Textarea, Textfield } from '@digdir/design-system-react'; | ||
import { Button, FormFieldCard } from '@catalog-frontend/ui'; | ||
|
||
import { localization } from '@catalog-frontend/utils'; | ||
|
||
import { Service } from '@catalog-frontend/types'; | ||
|
||
import styles from './service-form.module.css'; | ||
|
||
import { TrashIcon } from '@navikt/aksel-icons'; | ||
import { createNewPublicService } from '../../actions/public-services/actions'; | ||
|
||
type ServiceFormProps = { | ||
catalogId: string; | ||
service?: Service; | ||
}; | ||
|
||
export const ServiceForm = ({ catalogId, service }: ServiceFormProps) => { | ||
const createPublicService = createNewPublicService.bind(null, catalogId); | ||
|
||
return ( | ||
<> | ||
<div className='container'> | ||
<div className={styles.pageContainer}> | ||
<form action={createPublicService}> | ||
<div className={styles.formContainer}> | ||
<FormFieldCard | ||
title={localization.title} | ||
subtitle='Egenskapen brukes å til oppgi navn til en tjeneste' | ||
> | ||
<div> | ||
<Textfield | ||
defaultValue={service?.title.nb} | ||
label={ | ||
<div> | ||
<p>Tekst på bokmål</p> | ||
<Tag | ||
variant='secondary' | ||
color='first' | ||
size='small' | ||
> | ||
Må fylles ut | ||
</Tag> | ||
</div> | ||
} | ||
type='text' | ||
name='title.nb' | ||
/> | ||
</div> | ||
</FormFieldCard> | ||
<FormFieldCard | ||
title={localization.description} | ||
subtitle='Egenskapen brukes til å oppgi en tekstlig beskrivelse av tjenesten' | ||
> | ||
<Textarea name='description.nb' /> | ||
</FormFieldCard> | ||
</div> | ||
|
||
<div> | ||
<Button type='submit'>Lagre tjeneste</Button> | ||
{service ? ( | ||
<Button | ||
color='danger' | ||
variant='secondary' | ||
> | ||
<TrashIcon fontSize='1.5rem' /> | ||
Slett tjeneste | ||
</Button> | ||
) : ( | ||
<Button | ||
color='danger' | ||
variant='secondary' | ||
> | ||
Avbryt | ||
</Button> | ||
)} | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default ServiceForm; |
Empty file.
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 was deleted.
Oops, something went wrong.
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