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

move styles for search results and mobile menu #1710

Merged
merged 21 commits into from
Oct 11, 2024
Merged

Conversation

hasparus
Copy link
Collaborator

@hasparus hasparus commented Oct 7, 2024

Moving style overrides for Nextra's search results and mobile menu from Hive website in here, fixing what broke in the updates and trying to improve things I left messy when I was in a rush.

Made the mobile menu style overrides more civilized (as in, I don't use Tailwind classes in selectors anymore), the search results styles are still messy, but it should work.

Copy link

changeset-bot bot commented Oct 7, 2024

⚠️ No Changeset found

Latest commit: 3eb4ced

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@hasparus hasparus changed the title Nextra search results styles for nextra search results Oct 7, 2024
@@ -146,12 +146,12 @@ export function HiveNavigation({
{renderSlot(Search, {
// The && and :is(x) selector bump the specificity to 0-2-2 to override Nextra styles.
className: cn(
'relative ml-4 [&&_input:is(input)]:h-[48px] [&&_input:is(input)]:bg-white [&&_input:is(input)]:dark:bg-inherit [&&_input:is(input)]:rounded-lg [&&_input:is(input)]:border-green-200 [&&_input:is(input)]:pl-4 [&&_input:is(input)]:pr-8 [&&_kbd:is(kbd)]:absolute [&&_kbd:is(kbd)]:right-4 [&&_kbd:is(kbd)]:top-1/2 [&&_kbd:is(kbd)]:-translate-y-1/2 [&&_kbd:is(kbd)]:border-none [&&_kbd:is(kbd)]:bg-green-200 [&&_input:is(input)]:border dark:[&&_input:is(input)]:border-neutral-800 dark:[&&_kbd:is(kbd)]:bg-neutral-700 [&&_:is(input,kbd):is(input,kbd)]:text-green-700 dark:[&&_:is(input,kbd):is(input,kbd)]:text-neutral-300 [&&_kbd:is(kbd)]:my-0',
'relative ml-4 [&&_input:is(input)]:h-[48px] [&&_input:is(input)]:bg-white [&&_input:is(input)]:dark:bg-inherit [&&_input:is(input)]:rounded-lg [&&_input:is(input)]:border-green-200 [&&_input:is(input)]:pl-4 [&&_input:is(input)]:pr-8 [&&_kbd:is(kbd)]:absolute [&&_kbd:is(kbd)]:right-4 [&&_kbd:is(kbd)]:top-1/2 [&&_kbd:is(kbd)]:-translate-y-1/2 [&&_kbd:is(kbd)]:border-none [&&_kbd:is(kbd)]:bg-green-200 [&&_input:is(input)]:border dark:[&&_input:is(input)]:border-neutral-800 dark:[&&_kbd:is(kbd)]:bg-neutral-700 [&&_:is(input,kbd):is(input,kbd)]:text-green-700 dark:[&&_:is(input,kbd):is(input,kbd)]:text-neutral-300 [&&_kbd:is(kbd)]:my-0 [&&_input]:!w-full basis-64',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

basically, the searchbox doesn't shrink anymore, and this should make it work

Copy link
Collaborator

Choose a reason for hiding this comment

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

why do you use && and not &?

Copy link
Collaborator

Choose a reason for hiding this comment

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

also, what is the purpose of input:is(input)? higher priority? use !important

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, specificity. I'm definitely moving to importing nextra styles as layer. This is a good idea.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks better now, but I think it will be even better to change search classes from packages/components/style.css ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I kinda wanna avoid putting global styles in the CSS if we can pass a className with Tailwind somewhere. Here the Search component is rendered by our HiveNavigation, so we can style it through the parent.

Copy link
Contributor

github-actions bot commented Oct 7, 2024

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@theguild/components 7.0.0-alpha-20241011172916-3eb4ced9e4ffc2e4c641332234e0b15549f07a98 npm ↗︎ unpkg ↗︎

@hasparus hasparus changed the title styles for nextra search results move styles for search results and mobile menu Oct 7, 2024
@hasparus hasparus marked this pull request as ready for review October 7, 2024 17:39
Comment on lines 64 to 88
.light .hive-search-results .dark\:_text-gray-400:is(html[class~='dark'] *) {
@apply !text-green-800;
}

.light .hive-search-results .dark\:_text-gray-300:is(html[class~='dark'] *) {
@apply !text-green-1000;
}

.light .hive-search-results .dark\:_text-gray-300:is(html[class~='dark'] *) {
@apply !text-green-800;
}

.light .hive-search-results .dark\:_text-neutral-400:is(html[class~='dark'] *) {
color: rgb(107, 114, 128);
}

.light .hive-search-results,
.light .hive-search-results:is(html[class~='dark'] *) {
background-color: #fff;
border-color: #e5e7eb;
}

.light .hive-search-results .dark\:before\:_bg-neutral-800:is(html[class~='dark'] *):before {
background-color: rgb(229, 231, 235);
}
Copy link
Collaborator

@dimaMachina dimaMachina Oct 8, 2024

Choose a reason for hiding this comment

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

this is too overcomplicated and 100% will be broken in the future, import styles as layer https://nextra.site/docs/guide/advanced/customize-the-cascade-layers

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#1712 fixes this

Copy link
Collaborator

@dimaMachina dimaMachina left a comment

Choose a reason for hiding this comment

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

see my comments

@hasparus
Copy link
Collaborator Author

Merging because #1712 addressed the issues.

@hasparus hasparus merged commit ec5ba44 into v7 Oct 11, 2024
3 of 5 checks passed
@hasparus hasparus deleted the nextra-search-results branch October 11, 2024 17:36
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