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

Simplify site-header pattern #2

Closed
KittyGiraudel opened this issue Apr 21, 2016 · 2 comments
Closed

Simplify site-header pattern #2

KittyGiraudel opened this issue Apr 21, 2016 · 2 comments

Comments

@KittyGiraudel
Copy link

KittyGiraudel commented Apr 21, 2016

Link: http://www.flexboxpatterns.com/site-header.

Proposal

<div class="siteHeader">
  <div class="siteHeader__item siteHeaderLogo">
    <div class="fa fa-inbox"></div>
  </div>
  <div class="siteHeader__item siteHeaderButton is-site-header-item-selected">Inbox</div>
  <div class="siteHeader__item siteHeaderButton">Sent</div>
  <div class="siteHeader__item siteHeaderButton">Trash</div>
  <div class="siteHeader__item siteHeaderButton">Settings</div>
</div>

CSS

.siteHeader {
  display: flex;
  padding: 10px;
  background-color: #56727C;
}

    /* ... */
    .siteHeader__item:last-child {
      margin-left: auto;
    }

No need for sub-sections anymore. :)

Cheers.

@KittyGiraudel
Copy link
Author

KittyGiraudel commented Apr 21, 2016

Note that exact same thing can be applied on footer and sidebar. No need for sub-sections when you can use auto margin.

@cjcenizal cjcenizal changed the title Simplify site-header patter Simplify site-header pattern Apr 24, 2016
@cjcenizal
Copy link
Owner

@hugogiraudel Thanks a lot man! Sorry for addressing this so late... I'm getting my kitchen remodeled, I'm transitioning between jobs, and I went on vacation. 😄

You make a really good point. Of course, this would mean these components would no longer be good examples of using flexbox! So I updated the examples to illustrate how I think flexbox can be applied in a useful way. If you have a second to check it out, I'd like to know what you think.

These section elements are useful because now additional buttons/links can be added to them without needing to change any styles. If we were to use margin-left/top: auto, we'd have to do a little extra work to make sure they'd still be spaced apart correctly, so I think flexbox is better here.

BTW, thanks for your amazing work on sass-guidelin.es. It's been a huge influence on me for the past few years and I always recommend that people refer to it.

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

No branches or pull requests

2 participants