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

refactor theme bar, add extra param, add read from config option #22

Merged
merged 4 commits into from
Nov 16, 2020

Conversation

JugglerX
Copy link
Contributor

@JugglerX JugglerX commented Nov 12, 2020

Adds support for the additional url params in theme bar

new URL Params supported.

  • themeBarForkLink
  • themeBarNewSiteLink
  • themeBarNewSiteTheme

Also adds support to read config from https://themes.stackbit.com/themeBarConfig.js - so instead of having to really ugly url like http:https://themes.stackbit.com/demos/exto/?themeBarNewSite=Get Started&themeBarNewSiteLink=https://app.stackbit.com/create&themeBarNewSiteTheme=https://github.com/stackbit-themes/stackbit-starter-hugo you could use http:https://themes.stackbit.com/demos/exto?demo=jstStarterHugo which will read from the themeBarConfig.js by key

Also refactored the vanilla js to something more manageable

Copy link
Member

@VitaliyR VitaliyR left a comment

Choose a reason for hiding this comment

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

I'm generally prefer to remove this entirely from the unibit but it's ok for now.
@JugglerX please, ping me after releasing this so I can update my codebase at app + landing

@@ -7,7 +7,7 @@ module.exports = `<div id="theme-bar" class="theme-bar theme-bar-fixed theme-bar
<div class="theme-bar-center">
{% if stackbit_banner.github_url %}
<a
class="theme-bar-button theme-bar-button-outlined theme-bar-fork"
Copy link
Member

Choose a reason for hiding this comment

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

theme-bar-fork class was added by me - as far as I remember, it can be removed

newSiteLink.searchParams.set('theme', props.themeBarNewSiteTheme)
}

if (props.themeBarNewSiteParams) {
Copy link
Member

Choose a reason for hiding this comment

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

Amazing! So we can migrate from themeBarUserGroup. Please, ping me after releasing factory with this updated unibit version so I'll update the codebase

themeBarNewSite: searchParams.get("themeBarNewSite"),
themeBarNewSiteLink: searchParams.get("themeBarNewSiteLink"),
themeBarNewSiteTheme: searchParams.get("themeBarNewSiteTheme"),
themeBarUserGroup: searchParams.get("themeBarUserGroup")
Copy link
Member

Choose a reason for hiding this comment

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

@JugglerX @VitaliyR please rename this field to something else.
For my understanding, it is needed for an extra parameter like userGroup=nocode.
If this is the case please provide different parameter like: url_params=${encodeUrlComponent('userGroup=nocode')}

The idea is not to have parameter names specific to stackbit internal features as this is an open-source project.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed. this is now handled by themeBarNewSiteLinkParams or can be set in the config (which is even better)

Copy link
Member

@VitaliyR VitaliyR left a comment

Choose a reason for hiding this comment

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

@JugglerX thanks for clean up, LGTM

@JugglerX JugglerX merged commit 4588b58 into master Nov 16, 2020
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.

None yet

3 participants