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: support theme toggle in navbar. #499

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jason-dour
Copy link

  • Add additional logic for navbar partial.
  • Uses a menu item params.type of theme-toggle.
  • Uses additional params.hideLabel boolean to set hideLabel for the theme-toggle.html partial; defaults to true.

Addresses #343 .

- Add additional logic for navbar partial.
- Uses a menu item params.type of `theme-toggle`.
- Uses additional params.hideLabel boolean to set hideLabel for the theme-toggle.html partial.
Copy link

netlify bot commented Nov 16, 2024

Deploy Preview for hugo-hextra ready!

Name Link
🔨 Latest commit da56d15
🔍 Latest deploy log https://app.netlify.com/sites/hugo-hextra/deploys/673a6f6e7036cc00089b2c49
😎 Deploy Preview https://deploy-preview-499--hugo-hextra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jason-dour
Copy link
Author

This isn't a perfect PR, as I didn't include any updates to documentation for this feature and instead focused on implementation.

I figured if this looks good, I could add documentation changes to this PR. :)

- Add navbar boolean to theme-toggle partial arguments.
- Add logic in theme-toggle to set icon size based on navbar boolean.
@jason-dour
Copy link
Author

Gave theme-toggle partial logic based on navbar boolean, to set size of icon based on navbar or elsewhere.

This does not address the size of the toggle's label. I see the hx-text-xs present in theme-toggle. Could possibly add more logic around that.

@jason-dour
Copy link
Author

Put logic in theme-toggle when in navbar to match size of navbar text.

Copy link
Owner

@imfing imfing left a comment

Choose a reason for hiding this comment

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

will take a second look by manually testing it.

Comment on lines +2 to +7
{{- $height_px := 12 -}}
{{- $height_tw := "hx-text-xs" -}}
{{- if $navbar -}}
{{- $height_px = 24 -}}
{{- $height_tw = "hx-text-sm" -}}
{{- end -}}
Copy link
Owner

Choose a reason for hiding this comment

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

just curious where are 12 and 24 coming from?

Copy link
Author

Choose a reason for hiding this comment

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

Great question! I've been offline for a few weeks, and honestly, I'd have to say it is likely a best estimate based on testing that made things look "right."

If those values can be computed from other inputs in the theme configuration, I'm certainly willing to explore that. Do you have any guidance on how we might calculate a sane value for this?

@imfing imfing changed the title Implement theme toggle in navbar. feat: support theme toggle in navbar. Dec 8, 2024
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