Gilli.is / Portfolio and blog of Gilli Sigurdsson Sun, 28 Apr 2019 00:00:00 +0000 Direct flights to Iceland /notes/direct-flights-to-iceland /notes/direct-flights-to-iceland Sun, 28 Apr 2019 00:00:00 +0000 Inspiration: Emergence /notes/inspiration-emergence /notes/inspiration-emergence Wed, 25 Jul 2018 00:00:00 +0000 Nice guide for using SVG on the web /notes/nice-guide-for-using-svg-on-the-web /notes/nice-guide-for-using-svg-on-the-web Thu, 02 Aug 2018 00:00:00 +0000 ` element for SVGs still be able to manipulate it with CSS and javascript.]]> Webmentions /notes/webmentions /notes/webmentions Wed, 25 Jul 2018 00:00:00 +0000 Using HSL for web development /notes/hex-to-hsl /notes/hex-to-hsl Fri, 17 Aug 2018 00:00:00 +0000 Web design museum /notes/web-design-museum /notes/web-design-museum Tue, 25 Sep 2018 00:00:00 +0000 Contraste app /notes/contraste-app /notes/contraste-app Tue, 16 Oct 2018 00:00:00 +0000 Blobmaker /notes/blobmaker /notes/blobmaker Thu, 10 Jan 2019 00:00:00 +0000 A logo I made got featured /notes/a-logo-i-made-got-featured /notes/a-logo-i-made-got-featured Wed, 10 Apr 2019 00:00:00 +0000 The three year rule: How to stay motivated /notes/the-three-year-rule-how-to-stay-motivated /notes/the-three-year-rule-how-to-stay-motivated Thu, 01 Apr 2021 00:00:00 +0000 Theraputic motorcycle repair videos /notes/motorcycle-repair /notes/motorcycle-repair Tue, 06 Feb 2018 00:00:00 +0000 ]]> Baseline soft launch /notes/baseline-soft-launch /notes/baseline-soft-launch Fri, 30 Apr 2021 00:00:00 +0000 FOSDEM Open Source Design videos are online /notes/fosdem-open-source-design-videos-are-online /notes/fosdem-open-source-design-videos-are-online Wed, 07 Feb 2018 00:00:00 +0000 Baseline Embed Test /notes/baseline-embed-test /notes/baseline-embed-test Thu, 06 Jan 2022 00:00:00 +0000 ]]> Japan hotel /notes/japan-hotel /notes/japan-hotel Wed, 07 Feb 2018 00:00:00 +0000 103 Bits of Advice /notes/bits-of-advice /notes/bits-of-advice Tue, 03 May 2022 00:00:00 +0000 SimplyCredit Partner UI /projects/simplycredit-partner-ui /projects/simplycredit-partner-ui Fri, 05 Sep 2025 18:11:45 +0000 SimplyCredit /projects/simplycredit /projects/simplycredit Flex Partner UI /projects/flex-partner-ui /projects/flex-partner-ui Wed, 18 Dec 2019 00:00:00 +0000 Flex /projects/flex /projects/flex Wed, 22 Jan 2020 00:00:00 +0000 Ella /projects/ella /projects/ella Fri, 25 Apr 2025 00:00:00 +0000 remoteStorage /projects/remotestorage /projects/remotestorage Wed, 21 Jan 2015 00:00:00 +0000 Syncthing /projects/syncthing /projects/syncthing Thu, 03 Sep 2015 00:00:00 +0000 Sarpurinn /projects/sarpurinn /projects/sarpurinn Thu, 29 Jan 2015 00:00:00 +0000 RÚV /projects/ruv /projects/ruv Wed, 21 Jan 2015 00:00:00 +0000 Nostalgic /projects/nostalgic /projects/nostalgic Wed, 19 Sep 2018 00:00:00 +0000 Autorefi /projects/autorefi /projects/autorefi Thu, 25 Apr 2019 00:00:00 +0000 Norde Source /projects/norde-source /projects/norde-source Mon, 17 Feb 2020 00:00:00 +0000 Baseline /projects/baseline /projects/baseline Sun, 01 Jan 2023 00:00:00 +0000 Old freelance work 2010-2013 /projects/2.old-work /projects/2.old-work Mon, 09 Feb 2015 00:00:00 +0000 JPMorganChase /projects/jpmorganchase /projects/jpmorganchase Mon, 01 Sep 2025 00:00:00 +0000 The Best Designers Know Nothing About Your Industry /journal/the-best-designers-know-nothing-about-your-industry /journal/the-best-designers-know-nothing-about-your-industry Thu, 04 Sep 2025 00:00:00 +0000 Native image lazy loading /journal/native-image-lazy-loading /journal/native-image-lazy-loading Tue, 14 Jan 2020 00:00:00 +0000 ``` That's it, simple as pie! Now to demonstrate this I'll add a bunch of `
` tags below to create some space and then add an image of my cat. If you're using Chrome or Opera the image should not load until right before you get to it. If your internet is too fast you might not even notice it at all. While experimenting with this feature I had to open the developer tools in my browser and look at the network tab to see the image get loaded in as I scrolled down. Hopefully, if you are reading this in the near future, it will work in whatever browser you may be using. Here we go. Scroll down!



































































































Keep going!


























































































































Won't be long, keep scrolling!




















































































































































































































Almost there!




















































(image: gillis_cat.jpg) Finally! Maybe I made the space a bit too big. Anyway that's my cat. His name is Títan and he likes to eat tuna, play with toy mice, run around like crazy and of course cuddle on my desk as I work.]]>
Landing pages and Hugo /journal/generating-tens-of-landing-pages-with-hugo /journal/generating-tens-of-landing-pages-with-hugo Wed, 14 Mar 2018 00:00:00 +0000 {{ if .Site.Params.heroHeading }} {{ .Site.Params.heroHeading }} {{ else }} {{ .Site.Data.text.heroHeading }} {{ end }} I was really impressed with Hugo and its flexibility when it comes to bending it to your will like that and use it for something it wasn't really made for. The main drawback with the way I did this is that you can't include inline links in those variables. Given the number of partners we needed to create these websites for,we created a little bash script to take care of actually generating and updating all the sites. So if we need to update the design or fix a bug only one command is need to update tens, or perhaps hundreds in the future, of websites in one go. I'm happy to report that the client was extremely happy with the how things were set up and was quick to set up 15 partner websites right away.]]> Designers and their portfolios /journal/designers-and-their-portfolios /journal/designers-and-their-portfolios Sun, 05 Aug 2018 00:00:00 +0000 Selecting the last two elements with CSS /journal/selecting-the-last-two-elements-with-css-or-any-child-in-relation-to-last-child /journal/selecting-the-last-two-elements-with-css-or-any-child-in-relation-to-last-child Thu, 09 Apr 2015 00:00:00 +0000 Responsive tables using CSS Grid Layout /journal/responsive-tables-using-css-grid-layout /journal/responsive-tables-using-css-grid-layout Sun, 09 Sep 2018 00:00:00 +0000
Account Balance Limit Available
-250.000 500.000 250.000 Transfer
1.000.000 0 1.000.000 Transfer
150.000 0 150.000 Transfer
Total (USD): 900.000 500.000 1.400.000
## Prioritising the content First thing I want to do is decide what content is important to a mobile user and what we can let go off. This is just to declutter the interface and set our priorities straight. The table headers become rather useless to us on mobile since they will not be able to serve their job properly once I change the layout so I will hide them on mobile. For that I use the utility class I created called `.u-visually-hidden--mobile` that makes sure it's still there for people who use screen readers. ## Rows become grids Adding `display: grid` to the rows changes each row to a grid. I apply it on the rows so I can stack up some of the columns to save horizontal space. Next I want two grid rows within each table row. To do that I add `grid-template-rows: 1fr 1fr;` to the table row class. `1fr` means one fraction of the available space. This way both rows should be equal height and balanced. My goal is to have only 3 columns so I will create a template for the columns as well. The first two will be the most important ones, while the last one consists of only the transfer button so it doesn’t need as much space. Which is why I’ll add `grid-template-columns: 2fr 2fr 1fr;`, first two columns get 2 fractions of the available space each and the last one only gets one. ``` @media only screen and (max-width: 650px) { .table__row { display: grid; grid-template-columns: 2fr 2fr 1fr; grid-template-rows: 1fr 1fr; grid-column-gap: 1rem; align-items: center; } } ``` ## Stacking the columns The first column, Account, will stay in its own column. I then stack the account name above the account number and make the account number smaller to emphasise the hierarchy. @media only screen and (max-width: 650px) { .table__account { grid-column: 1; grid-row: span 2; } .table__account-content { display: flex; flex-direction: column; } .table__account-number { order: 2; font-size: 12px; padding-top: 0.25rem; } } I want to try to limit the width to two or three columns and since "Limit" is not that important to be present on this screen — And because it mostly shows zeroes — I'll be removing it from display. They would usually be able to see the limit on their account page anyway so it's not a priority for this overview table. I think you can assume that people usually only have a limit on one account and know how much it is. The "Balance" and "Available" columns are going to get stacked on top of each other with the following code: @media only screen and (max-width: 650px) { .table__balance { grid-column: 2; grid-row: 2; font-size: 0.75rem; padding-top: 0.125rem; } .table__available { grid-column: 2; grid-row: 1; padding-bottom: 0.125rem; } } They are very related content and stacking them should give you a quick overview. But there is a problem. I got rid of the table headers so there is no indication of what the numbers mean at the moment. To fix that problem I’m adding the following CSS: ``` @media only screen and (max-width: 650px) { .table__balance::before { content: "Balance: "; } } ``` This adds the text “Balance: “ before the balance tag on mobile devices giving a clear distinction between the two values. Finally I make the transfer button span two rows so it is vertically centered with the other content like so: @media only screen and (max-width: 650px) { .table__transfer { grid-column: 3; grid-row: span 2; } } ## The results It wasn't very complicated but the results are a neat and simple mobile friendly layout that is easy to use and understand. I've added a few cosmetic styles just to make it look a bit better but what I have shown here above are the important parts and the results are here in this pen:

See the Pen Responsive tables using CSS Grid Layout by Gilli Sigurðs (@gilli) on CodePen.

## Why? Now you may be thinking “But Gilli, why do we use tables at all then? Wouldn't it be simpler to just use CSS grid all the time". Here are some of the reasons to use tables: * This is tabular data so using tables makes perfect sense. * For Accessibilities sake since it should be more understandable for screen readers and shouldn't surprise the user. * This approach can be used on an already existing codebase to make it responsive without having to rebuild everything. In fact you could probably get away with only adding CSS and not touching the html. * People are already familiar with tables and expect them. However if the content is much more readable without it then by all means go for it. ## Conclusion and caveats Overall I think CSS Grid Layout is incredibly powerful to transform content completely and adapt it to whatever scenario you need to. I haven't used this solution in a production environment yet so there might be some more problems that I haven't thought of but mostly I haven't see any big ones so far, (link:https://caniuse.com/#search=css%20grid%20layout http:// text: except for browser support of course). However here are a couple of caveats that you should keep in mind before using this: * You can't dump any table with any content into it and be good to go. You have to actually think about the content for each table and how it should fit. * It doesn't support huge tables without either creating monster stacks or hiding a lot of the columns.]]>
My problem with responsive images /journal/my-problem-with-responsive-images-and-an-idea-to-improve-them /journal/my-problem-with-responsive-images-and-an-idea-to-improve-them Wed, 15 Jan 2014 00:00:00 +0000 How to get better at design /journal/how-to-get-better-at-design /journal/how-to-get-better-at-design Tue, 05 Feb 2019 00:00:00 +0000 Out-of-stock badge for Drupal Commerce /journal/how-to-create-an-out-of-stock-badge-for-drupal-commerce /journal/how-to-create-an-out-of-stock-badge-for-drupal-commerce Thu, 10 Jan 2013 00:00:00 +0000 { "rules_out_of_stock" : { "LABEL" : "Out of Stock", "PLUGIN" : "reaction rule", "REQUIRES" : [ "rules", "entity" ], "ON" : [ "commerce_product_presave" ], "IF" : [ { "entity_is_of_type" : { "entity" : [ "commerce-product" ], "type" : "commerce_product" } }, { "data_is" : { "data" : [ "commerce-product:commerce-stock" ], "value" : "0" } } ], "DO" : [ { "data_set" : { "data" : [ "commerce-product:status" ], "value" : 0 } } ] } } This rule is the courtesy of akalata and was found [here](http://drupal.org/node/1689458#comment-6619434) When enabled, this rule will disable product variations that are out of stock. So let's say you have a sweater with 3 different sizes: "Small", "Medium" and "Large". Once one of them reaches 0 in stock, the rule will disable that variation leaving only Medium and Large to choose from. So when the last available size runs out of stock the add to cart button will say: "Product not available" Another rule found on the same page and created by [kirie](https://www.drupal.org/node/1689458#comment-6761182) is also pretty useful alongside this one since it enables the variation again once it is back in stock. Just in case you forget to enable it when adding more stock:
 { "rules_stock_enable_product_when_back_in_stock" : {
    "LABEL" : "Stock: enable product when back in stock",
    "PLUGIN" : "reaction rule",
    "TAGS" : [ "Emoda" ],
    "REQUIRES" : [ "rules", "entity" ],
    "ON" : [ "commerce_product_presave" ],
    "IF" : [
      { "entity_is_of_type" : { "entity" : [ "commerce-product" ], "type" : "commerce_product" } },
      { "data_is" : {
          "data" : [ "commerce-product:commerce-stock" ], "op" : "\u003E", "value" : "0"
        }
      }
    ],
    "DO" : [
      { "data_set" : { "data" : [ "commerce-product:status" ], "value" : 1 } }
    ]
  }
}
## The Add to cart form In it's current form the rule is already providing better UX because it causes the variations that are out of stock to disappear from the select list so users don't have to select it on it only to find out that it is out of stock, because it simply isn't there anymore. So now that we have the rule implemented it is time to make the add to cart badge show up on the product list's so that we can implement the CSS hack and manipulate it to serve as a out of stock badge. Start by going to "admin/structure/types" and click "Manage Display" for the variation type you want to create the badge for. Next click on "Product list" and find either "Product" or "Product variations" in the list and click on the select list for it's format and choose "Add to Cart form". Finally move the field so that it is positioned right below the product image. Now save and check your product list. The add to cart form should now be visible below the product image like in the example image here to the right, although most likely it doesn't look very pretty. (image: add-to-cart.jpg alt:Image saying "products not available) ## The CSS Trickery Now that we have the add to cart form there we can begin hacking it to serve as a out of stock badge. You will have to add some CSS into your theme in order to hide the add-to-cart form when the product is in stock and only display it when out of stock. Add the following code to the bottom of your themes stylesheet: (NOTE: If you are not using Commerce Kickstart the following code might not work for you, however you should be able to figure out what is going on and implement it yourself, given that you know some CSS)
.view-collection-products .field-type-commerce-product-reference {
padding: 0;
margin: 0;
}
.view-collection-products .field-type-commerce-product-reference form.commerce-add-to-cart .form-submit.form-button-disabled {
margin: 0;
margin-top: -120px;
background: #FF4747;
text-align: center;
width: 100%;
padding: 10px 0 10px 0;
-moz-border-radius: 0;
-webkit-border-radius: 0;
-khtml-border-radius: 0;
border-radius: 0;
}
.view-collection-products .field-type-commerce-product-reference form.commerce-add-to-cart {
padding: 0;
height: 1px;
}
.view-collection-products .commerce-add-to-cart.in-stock {
display: none;
}
(image: complete.jpg alt:Image showing a product that is sold out) That's it! Now your products in the product list should look something like the image here to the right. However the text still says "Product not available". So all you have to do is change that to "Out of stock" or something like that, which I did it quickly using the Locale module since the website I was working on was in Icelandic anyway. Now if you are using Commerce Kickstart you might want to use these styles as well since it will create the badge on the "All Products" page as well.
.page-products .field-type-commerce-product-reference {
padding: 0;
margin: 0;
}
.page-products .field-type-commerce-product-reference form.commerce-add-to-cart .form-submit.form-button-disabled {
margin: 0;
margin-top: -120px;
background: #FF4747;
text-align: center;
width: 100%;
padding: 10px 0 10px 0;
-moz-border-radius: 0;
-webkit-border-radius: 0;
-khtml-border-radius: 0;
border-radius: 0;
}
.page-products .field-type-commerce-product-reference form.commerce-add-to-cart {
padding: 0;
height: 1px;
}
.page-products .commerce-add-to-cart.in-stock {
display: none;
}
This is the first tutorial I create so I would love some feedback and stories from people who try this out. Shoot me a message on [twitter](http://twitter.com/gillisig) if you have any.]]>
Why designing for open source can be so difficult /journal/why-designing-for-open-source-can-be-so-difficult /journal/why-designing-for-open-source-can-be-so-difficult Tue, 11 Feb 2020 00:00:00 +0000 Creative energy /journal/creative-energy /journal/creative-energy Thu, 12 Feb 2015 00:00:00 +0000 Notifications are out of control /journal/notifications-are-out-of-control /journal/notifications-are-out-of-control Sun, 13 Jun 2021 00:00:00 +0000 Do's and don'ts for presentation and critique /journal/do-s-and-dont-s-for-presentation-and-critique /journal/do-s-and-dont-s-for-presentation-and-critique Sun, 11 Sep 2016 00:00:00 +0000
?>