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

Add support of Global Notification #2071

Open
4 tasks done
naranyinyun opened this issue Mar 11, 2023 · 5 comments
Open
4 tasks done

Add support of Global Notification #2071

naranyinyun opened this issue Mar 11, 2023 · 5 comments
Labels
docs Improvements or additions to documentation stale

Comments

@naranyinyun
Copy link

naranyinyun commented Mar 11, 2023

Is your feature request related to a problem? Please describe.

Sometimes I need to inform the user about a project, such as status or other notifications.

Describe the solution you'd like

I think adding a banner at the top of the page would be a good solution.
It should be at the top of the page, with the content box on the left and centre and a cancel button on the right.

Describe alternatives you've considered

No response

Additional context

No response

Validations

@brc-dd
Copy link
Member

brc-dd commented Mar 11, 2023

You can use layout-top slot for that: https://vitepress.dev/guide/extending-default-theme#layout-slots

Refer this PR for reference: faker-js/faker#1487

@brc-dd brc-dd added the docs Improvements or additions to documentation label Mar 11, 2023
@brc-dd brc-dd reopened this Mar 16, 2023
@brc-dd
Copy link
Member

brc-dd commented Mar 16, 2023

Keeping it open for docs.

@xsjcTony
Copy link
Contributor

xsjcTony commented Oct 3, 2024

@brc-dd Thanks for redirecting me to here, I've tried your implementation, but I think it's still better to make it built-in.

I know those are all for preventing layout shifts during SSR, but it's basically all caused by we are using layout-top slots, and the navbar is with position: fixed in wider screen causing the main content to have top: based on the --layout-top-height.

If we can change the HTML structure a bit, to make it part of the documents instead of inserting into the slot and changes those heights and CSS variables with JS, it's going to be a lot easier to deal with.

Thoughts? 🙏

@xsjcTony
Copy link
Contributor

xsjcTony commented Oct 3, 2024

Once one of the above is missing, it's just hard to get it done.
E.g. the OXC documentation: https://oxc.rs/docs/guide/usage/linter.html
If you close the banner, and refresh the page. You can see a flick of the banner showing up because they missed the script to add .banner-dismissed globally in the head.
And if you refresh the page with the banner open on the small screen, there will be some CLS because the media query px value is not 100% correct.

Those are all because of the lack of built-in support, and due to that we are using the slot way, it's also hard to make it dynamic, e.g. to make it a plugin.

Honestly I think make this built-in is kind of a basic functionality of content-based SSG tool, especially VitePress is widely used for documenting technical tools.

@github-actions github-actions bot removed the stale label Oct 12, 2024
@brc-dd brc-dd removed their assignment Nov 1, 2024
@github-actions github-actions bot added the stale label Dec 3, 2024
@thagxt
Copy link

thagxt commented Feb 3, 2025

Yes, this functionality should be built-in! The more I work with VitePress, the more I’m convinced I made the wrong choice and should have gone with Starlight instead. It really seems we have to build everything basic ourselves. Furthermore, the level of support and community engagement here is rather disappointing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to documentation stale
Projects
None yet
Development

No branches or pull requests

4 participants