-
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.
feat(app-sys): changes to app sys that were bundled with financial ai…
…d update (#17210) * feat: changes to app sys that were bundled with financial aid update * chore: add in line break * chore: add in line break * chore: undo changes to reference-template * chore: remove unused import --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
5a13f96
commit 444cedf
Showing
9 changed files
with
261 additions
and
2 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
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
55 changes: 55 additions & 0 deletions
55
libs/application/ui-fields/src/lib/AccordionFormField/AccordionFormField.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,55 @@ | ||
import { | ||
AccordionField, | ||
AccordionItem as AccordionItemType, | ||
FieldBaseProps, | ||
} from '@island.is/application/types' | ||
import { Accordion, AccordionItem, Box, Text } from '@island.is/island-ui/core' | ||
import { useLocale } from '@island.is/localization' | ||
import { formatText, formatTextWithLocale } from '@island.is/application/core' | ||
import { Markdown } from '@island.is/shared/components' | ||
import { useEffect, useState } from 'react' | ||
|
||
interface Props extends FieldBaseProps { | ||
field: AccordionField | ||
} | ||
export const AccordionFormField = ({ field, application }: Props) => { | ||
const [items, setItems] = useState<Array<AccordionItemType>>() | ||
const { formatMessage, lang: locale } = useLocale() | ||
const { accordionItems, marginBottom, marginTop, title, titleVariant } = field | ||
useEffect(() => { | ||
if (typeof accordionItems === 'function') { | ||
setItems(accordionItems(application)) | ||
} else { | ||
setItems(accordionItems) | ||
} | ||
}, [accordionItems]) | ||
if (!items || items.length === 0) { | ||
return null | ||
} | ||
return ( | ||
<Box marginTop={marginTop} marginBottom={marginBottom}> | ||
{title && ( | ||
<Box marginBottom={1}> | ||
<Text variant={titleVariant ?? 'h3'}> | ||
{formatTextWithLocale(title, application, locale, formatMessage)} | ||
</Text> | ||
</Box> | ||
)} | ||
<Accordion> | ||
{items.map((item, index) => { | ||
return ( | ||
<AccordionItem | ||
key={`accordion-item-${index}`} | ||
id={`accordion-item-${index}`} | ||
label={formatText(item.itemTitle, application, formatMessage)} | ||
> | ||
<Markdown> | ||
{formatText(item.itemContent, application, formatMessage)} | ||
</Markdown> | ||
</AccordionItem> | ||
) | ||
})} | ||
</Accordion> | ||
</Box> | ||
) | ||
} |
82 changes: 82 additions & 0 deletions
82
libs/application/ui-fields/src/lib/BankAccountFormField/BankAccountFormField.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,82 @@ | ||
import { | ||
coreDefaultFieldMessages, | ||
formatText, | ||
formatTextWithLocale, | ||
} from '@island.is/application/core' | ||
import { BankAccountField, FieldBaseProps } from '@island.is/application/types' | ||
import { Box, GridColumn, GridRow, Text } from '@island.is/island-ui/core' | ||
import { useLocale } from '@island.is/localization' | ||
import { InputController } from '@island.is/shared/form-fields' | ||
|
||
interface Props extends FieldBaseProps { | ||
field: BankAccountField | ||
} | ||
export const BankAccountFormField = ({ field, application }: Props) => { | ||
const { formatMessage, lang: locale } = useLocale() | ||
const { marginBottom, marginTop, title, titleVariant, id } = field | ||
const bankNumber = formatText( | ||
coreDefaultFieldMessages.defaultBankAccountBankNumber, | ||
application, | ||
formatMessage, | ||
) | ||
const ledger = formatText( | ||
coreDefaultFieldMessages.defaultBankAccountLedger, | ||
application, | ||
formatMessage, | ||
) | ||
const accountNumber = formatText( | ||
coreDefaultFieldMessages.defaultBankAccountAccountNumber, | ||
application, | ||
formatMessage, | ||
) | ||
return ( | ||
<Box marginTop={marginTop} marginBottom={marginBottom}> | ||
{title && ( | ||
<Box marginBottom={1}> | ||
<Text variant={titleVariant ?? 'h3'}> | ||
{formatTextWithLocale(title, application, locale, formatMessage)} | ||
</Text> | ||
</Box> | ||
)} | ||
<GridRow> | ||
<GridColumn span={['12/12', '12/12', '12/12', '4/12']}> | ||
<Box marginBottom={[2, 2, 4]}> | ||
<InputController | ||
id={`${id}.bankNumber`} | ||
defaultValue="" | ||
label={bankNumber} | ||
placeholder="0000" | ||
format="####" | ||
backgroundColor="blue" | ||
autoFocus | ||
/> | ||
</Box> | ||
</GridColumn> | ||
<GridColumn span={['12/12', '12/12', '12/12', '2/12']}> | ||
<Box marginBottom={[2, 2, 4]}> | ||
<InputController | ||
id={`${id}.ledger`} | ||
defaultValue="" | ||
label={ledger} | ||
placeholder="00" | ||
format="##" | ||
backgroundColor="blue" | ||
/> | ||
</Box> | ||
</GridColumn> | ||
<GridColumn span={['12/12', '12/12', '12/12', '6/12']}> | ||
<Box marginBottom={[2, 2, 4]}> | ||
<InputController | ||
id={`${id}.accountNumber`} | ||
defaultValue="" | ||
label={accountNumber} | ||
placeholder="000000" | ||
format="######" | ||
backgroundColor="blue" | ||
/> | ||
</Box> | ||
</GridColumn> | ||
</GridRow> | ||
</Box> | ||
) | ||
} |
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