Skip to content
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

Merged
merged 4 commits into from
Nov 13, 2024
Merged

feat: navbar extra button from contentful #565

merged 4 commits into from
Nov 13, 2024

Conversation

cazala
Copy link
Member

@cazala cazala commented Nov 13, 2024

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:
Screenshot 2024-11-13 at 11 40 04 AM

Screenshot 2024-11-13 at 11 40 16 AM Screenshot 2024-11-13 at 11 40 55 AM Screenshot 2024-11-13 at 11 50 02 AM

Copy link

vercel bot commented Nov 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
decentraland-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 13, 2024 3:44pm

border-radius: 8px;
justify-content: center;
border-bottom: none;
}
Copy link
Member Author

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;
}
Copy link
Member Author

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'
Copy link
Member Author

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
}
}
Copy link
Member Author

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.

Copy link
Contributor

@braianj braianj left a 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

Comment on lines 44 to 47
const SPACE_ID = 'ea2ybdmmn1kv'
const ENV = 'master'
const ACCESS_TOKEN = '9dieh3AHS6uwb_YNMjxlO6FCibAFFJVdg2YzA5t6U-Y'
const ENTRY_ID = '18g1DzIyBxvu0steSwKyQr'
Copy link
Contributor

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

@cazala cazala merged commit 80dff04 into master Nov 13, 2024
6 checks passed
@cazala cazala deleted the feat/estra-button branch November 13, 2024 15:55
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.

2 participants