Skip to content

Commit c4fbb7b

Browse files
authored
chore(404): update use cases
1 parent 6c64f95 commit c4fbb7b

File tree

1 file changed

+70
-23
lines changed

1 file changed

+70
-23
lines changed

docs/javascript/use-cases.md

Lines changed: 70 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -848,36 +848,83 @@ One way to make search tab easier to differenciate is to add an icon next to eac
848848

849849
It is possible to customize not found error page using our design system components. If you only wish to change the error message while keeping the go back home button, you can retrieve the button props from the context and only change the rest of the page.
850850

851+
### Without reusing the go back home button
852+
853+
```js
854+
window.lumapps.customize(({ targets, components, render, placement, constants }) => {
855+
const { Card, FlexBox, Thumbnail, Text } = components;
856+
const { Orientation, Alignment, ThumbnailVariant, Size, ColorPalette, Typography } = constants;
857+
858+
render({
859+
placement: placement.REPLACE,
860+
target: targets.NOT_FOUND_PAGE,
861+
toRender: FlexBox({
862+
children: Card({
863+
children: FlexBox({
864+
orientation: Orientation.vertical,
865+
vAlign: Alignment.center,
866+
hAlign: Alignment.center,
867+
gap: 'huge',
868+
children: [
869+
Text({
870+
typography: Typography.display1,
871+
children: 'Oh snap!'
872+
}),
873+
Text({
874+
typography: Typography.body1,
875+
children: 'Seems that the page you were looking for has been deleted or you do not have access to it.'
876+
})
877+
]
878+
}),
879+
}),
880+
orientation: Orientation.vertical,
881+
vAlign: Alignment.center,
882+
hAlign: Alignment.center,
883+
fillSpace: true,
884+
}),
885+
});
886+
});
887+
```
888+
851889
```js
852890
window.lumapps.customize(({ targets, components, render, placement, constants }) => {
853-
const { Message, Icon, FlexBox, Button } = components;
854-
const { Orientation, Alignment, Kind, Size } = constants;
891+
const { Card, FlexBox, Thumbnail, Text, Icon, Button, Message } = components;
892+
const { Orientation, Alignment, ThumbnailVariant, Size, ColorPalette, Typography, Kind } = constants;
855893

856894
render({
857895
placement: placement.REPLACE,
858896
target: targets.NOT_FOUND_PAGE,
859-
toRenderWithContext: ({ button }) =>
860-
FlexBox({
861-
children: [
862-
Icon({ size: Size.xl, hasShape: true, icon: 'file-question', key: 'icon' }),
863-
Message({
864-
kind: Kind.warning,
865-
hasBackground: true,
866-
children:
867-
'Something got wrong... If this is not coming from a wrong URL, please reach your administrator.',
868-
key: 'message',
869-
className: 'lumx-spacing-margin-top-big',
870-
}),
871-
Button({
872-
key: 'button',
873-
className: 'lumx-spacing-margin-top-big',
874-
...button,
875-
leftIcon: 'home',
876-
}),
877-
],
878-
orientation: Orientation.vertical,
879-
vAlign: Alignment.center,
897+
toRenderWithContext: ({ button }) => FlexBox({
898+
children: Card({
899+
children: FlexBox({
900+
orientation: Orientation.vertical,
901+
vAlign: Alignment.center,
902+
hAlign: Alignment.center,
903+
gap: 'huge',
904+
children: [
905+
Icon({ size: Size.xl, hasShape: true, icon: 'file-question', key: 'icon' }),
906+
Message({
907+
kind: Kind.warning,
908+
hasBackground: true,
909+
children:
910+
'Something got wrong... If this is not coming from a wrong URL, please reach your administrator.',
911+
key: 'message',
912+
className: 'lumx-spacing-margin-top-big',
913+
}),
914+
Button({
915+
key: 'button',
916+
className: 'lumx-spacing-margin-top-big',
917+
...button,
918+
leftIcon: 'home',
919+
}),
920+
]
921+
}),
880922
}),
923+
orientation: Orientation.vertical,
924+
vAlign: Alignment.center,
925+
hAlign: Alignment.center,
926+
fillSpace: true,
927+
}),
881928
});
882929
});
883930
```

0 commit comments

Comments
 (0)