Skip to content

spike: using history.back() for 'Back' button#8

Open
hqtan wants to merge 2 commits intowork-onsite-days-page-initial-setupfrom
spike-use-browser-history-for-back-button
Open

spike: using history.back() for 'Back' button#8
hqtan wants to merge 2 commits intowork-onsite-days-page-initial-setupfrom
spike-use-browser-history-for-back-button

Conversation

@hqtan
Copy link
Owner

@hqtan hqtan commented Mar 14, 2022

  • replaced <BackButton> component with <Button> component from Chakra UI
  • onClick handler for 'Back' <Button> will save responses, send logs, then
    browse back to previous page (using browser history)

hqtan added 2 commits March 14, 2022 15:19
- replaced `<BackButton>` component with `<Button>` component from Chakra UI
- `onClick` handler for 'Back' `<Button>` will save responses, send logs, then
  browse back to previous page (using browser history)
@vercel
Copy link

vercel bot commented Mar 14, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/hqtan/hqtan-council-emissions-calculator-spike/7eoaSp6LeQrrhzHw5tQSESqoSnJU
✅ Preview: https://hqtan-council-emissions-calculator-spike-git-spike-abc720-hqtan.vercel.app

Comment on lines +56 to +64
<Button
onClick={() => backButtonOnClickHandler()}
variant="ghost"
>
<BackArrow />
<Text ms={2} as="u" color="var(--chakra-colors-blue-600)">
{"Back"}
</Text>
</Button>
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace <BackButton> component with regular Chakra <Button> component:

  • we no longer have to wrap <Button> component inside a <Link> component

Comment on lines +48 to +50
const backButtonOnClickHandler = (msg="Back button clicked") => {
saveDataAndShowLog(msg)
history.back();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Back' <Button>'s onClick handler.
saves responses, and sends logs, then goes to previous page using browser's history.back() function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant