-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: navbar extra button from contentful #565
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
border-radius: 8px; | ||
justify-content: center; | ||
border-bottom: none; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The styles above adjust the paddings/margins when the button has a background (.has-background
) otherwise the default styles don't look okay with a background.
|
||
.item.mobile.dui-menu-item.extra.has-background .dui-icon-container.centered { | ||
display: none; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This removes a div that is used to render icons, it's not used on the extra button, and it caused the text on the mobile extra button to not be centered, so I hide it.
'dui-menu-item', | ||
section, | ||
isMobile && 'mobile', | ||
backgroundColor && 'has-background' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applies a has-background
class when using a backgroundColor
to fix some paddings/margins
} catch (error) { | ||
// error parsing cached data, ignore and fetch from Contentful | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This above restores the data from a localStorage cache, to avoid hitting contentful every time. The TTL is configured form contentful itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏽
I just leave one comment
src/components/Navbar/utils.ts
Outdated
const SPACE_ID = 'ea2ybdmmn1kv' | ||
const ENV = 'master' | ||
const ACCESS_TOKEN = '9dieh3AHS6uwb_YNMjxlO6FCibAFFJVdg2YzA5t6U-Y' | ||
const ENTRY_ID = '18g1DzIyBxvu0steSwKyQr' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about adding this into src/config/env/prod.json
This PR adds an extra button to the navbar that can be configured form contentful. It can be toggled on/off, it can have a text color and/or a background color, and the TTL of the button data can be configured from contentful to lower to amount of requests. Currently I set it to 1 hour (3600 seconds).
Some examples: