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

Create a left and right topbar section (maybe a middle one as well?) #6

Closed
choldgraf opened this issue Mar 14, 2021 · 9 comments
Closed
Labels
type: discussion Discussion of general questions, ideas, design, etc.

Comments

@choldgraf
Copy link
Contributor

choldgraf commented Mar 14, 2021

It is common to have topbar content that is both justified to the left and justified to the right. Other themes also include a "center topbar" section that aligns with the page content.

How could we accommodate these different workflows?

For example:

pydata sphinx theme uses left, center, and right topbar areas:

image

gitbook theme uses left, center, and right topbar areas:

image

quantecon theme uses left, and right topbar areas:

image

@pradyunsg
Copy link
Owner

Yup yup. My thought process is that this would be what the default wrapper would provide. I just didn't have enough time to write it all down. 🙃

@pradyunsg pradyunsg added the type: discussion Discussion of general questions, ideas, design, etc. label Mar 15, 2021
@pradyunsg
Copy link
Owner

Bringing this over from the above issue:

I think the header should be split into left_header and right_header template sections.

Actually, I had a bit of a different idea for this:

  • If there's 2 tags (i.e. elements) in the header component, they would be left-right aligned.
  • If there's 3 elements in the header component, they would be left-center-right aligned.

This is much easier to maintain upstream thanks to fewer points to interact with downstream themes and it is easier to adapt for RTL languages as well.

@choldgraf
Copy link
Contributor Author

interesting - that seems reasonable from an end-user standpoint, though I must admit that it seems complicated to implement from my perspective. If you think it's more straightforward though, then go for it :-)

@pradyunsg
Copy link
Owner

Flexbox FTW!

https://css-tricks.com/snippets/css/a-guide-to-flexbox/#justify-content

Just need to have justify-content: space-between. :)

@choldgraf
Copy link
Contributor Author

choldgraf commented Mar 15, 2021

wow that's cool - so then from a theme developer's standpoint, you'd need to document that "any components put in the topbar should use the justify-content CSS rule"? That's not something that could automatically be done for people right?

Also just a note that what I've seen more-commonly than having the center <div> right in the middle, is instead having it justified to the "content section" of the page. E.g., that's what gitbook does as well as the pydata theme. Maybe that is something theme-specific though

@pradyunsg
Copy link
Owner

The sections/topbar.html file would be:

<div>This is aligning left</div>
<div>This is aligning right</div>

Or

<div>This is aligning left</div>
<div>This is aligning center</div>
<div>This is aligning right</div>

And they'll get aligned as the names suggest. :)

@choldgraf
Copy link
Contributor Author

makes sense - so basically a sub-theme would:

  1. Override sections/topbar.html in their template.

  2. If they added two divs like:

    <div>{{ include some templates }}</div>
    <div>{{ include some templates }}</div>
    

    Then they'd be in two divs that take up the left and right half of the screen.

and if they added in a third div, then the middle div would be middle-centered.

or maybe more generally the divs would have the same width and spread evenly?

@pradyunsg
Copy link
Owner

and if they added in a third div, then the middle div would be middle-centered.

Yes, if the left and right are the same width. Otherwise the middle item will be slightly off.

or maybe more generally the divs would have the same width and spread evenly?

Not the width but yea, spread evenly.

@pradyunsg
Copy link
Owner

Closing this out, since downstream themes should be able to do this on their own, through regular margin shenenigans/floats/flexbox; and I'd prefer to give them more direct control.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: discussion Discussion of general questions, ideas, design, etc.
Projects
None yet
Development

No branches or pull requests

2 participants