All of the notes are written first draft.

master
Zed A. Shaw 4 years ago
parent d0c1a3b39b
commit 22e8fb8eeb
  1. 6
      public/build/bundle.css
  2. 15349
      public/build/bundle.js
  3. 2
      public/build/bundle.js.map
  4. 14
      public/code/Calendar.notes.html
  5. 2
      public/code/Cards.notes.html
  6. 55
      public/code/GridOverGraphic.notes.html
  7. 1
      public/code/Login.notes.html
  8. 23
      public/code/Panels.notes.html
  9. 19
      public/code/Tiles.notes.html
  10. 1
      src/About.svelte
  11. 7
      src/App.svelte
  12. 2
      src/demos/Calendar.svelte
  13. 2
      src/demos/Cards.svelte
  14. 2
      src/demos/GridOverGraphic.svelte
  15. 2
      src/demos/Login.svelte
  16. 2
      src/demos/Panels.svelte
  17. 2
      src/demos/Tiles.svelte
  18. 2
      src/routes.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,14 @@
<p>The HTML in this demo is using the Svelte templating system to generate a bunch of fake dates. This makes it easier for you to see the essential HTML, but might confuse you if you don't know the syntax.</p>
<p>This CSS demo uses the grid system to create a 7 column grid, but <b>auto</b> rows. You then just write each date as a tag and the grid does the rest for you. You should also notice how I did the month display on the top:</p>
<pre>
<code class="language-css">
calendar month {
grid-column: span 7;
}
</code>
</pre>
<p>When you're dealing with a regular grid like this it's easier to use numeric indexes, but I think for more complex layouts it's better to use the method in <a href="/#/demos/GridOverGraphic">GridOverGraphic</a> where you name the grid cells instead of using numbers.</p>

@ -0,0 +1,2 @@
<p>A card is another container similar to a <a href="/#/demos/Tiles">Tiles</a> but vertical. You'll also notice the main image takes over the entire space so its main focus is on displaying an image with text and buttons. There's various ways to organize a card, but I chose just one that was common.</p>
<p>

@ -0,0 +1,55 @@
<p>When you use Photoshop--or any visual editing software--you have the concept of "layers". If your page is A4 size, and you create 10 layers, then it has 10 A4 sized invisible sheets stacked on top of each other. It's a simple concept that's so simple it's weird to explain it, and yet the browser does not have this essential concept needed for advanced compositing.</p>
<p>To accomplish the same thing in CSS you have to follow this process:</p>
<ol>
<li>Create an outer box that is set to <b>position: relative</b> or any position that's not <b>static</b>.</li>
<li>Create an inner box that's set to <b>position: absolute</b>.</li>
<li>Set this inner box (the bottom layer) to <b>top</b>, <b>bottom</b>, <b>left</b>, <b>right</b> all to <b>0</b>, which sticks the layer's dimensions to the same as the outer box.</li>
<li>Place your next layer on this like normal by putting it inside the outerbox.</li>
<li>Use the <b>z-index:</b> to alter the layers' ordering if the natural ordering isn't correct.</li>
</ol>
<p>The secret that nobody tells you is <b>position:absolute</b> has a footgun which makes it behave differently depending on its outer box. If your outer box doesn't have a position set then your attempt to use <b>position:absolute</b> will cover the entire browser window, <b>but</b> if the outer box is given any other position setting <em>then</em> the <b>position:absolute</b> will cover the outer box.</p>
<p>So the next time a CSS guru says to you, "just use position:absolute", you can fire back a strategically placed sniper shot of, "Don't you mean use position:absolute inside another box set to position:relative or did you not know that?"</p>
<h2>Using Named Grid Cells</h2>
<p>The most important thing about this demo is using <b>named grid cells</b> using <b>grid-template-areas:</b> in the grid, and then using <b>grid-area:</b> in each element you want in the cell. First, I set the <b>overlay</b>:
<pre>
<code class="language-css">
overlay {
display: grid;
grid-template-columns: repeat(2,1fr);
grid-template-rows: auto;
grid-template-areas:
"topleft topright"
"middle middle"
"bottomleft bottomright";
}
</code>
</pre>
<p>You name the areas using <b>"name name name"</b> for each column, and you can set a cell empty using the dot (.) as a name. In the above example I have <b>"topleft topright"</b> for the first row, <b>"middle middle"</b> for the second row, and <b>"bottomleft bottomright"</b> for the last row. You'll also notice I used "middle middle" so that when I use that name it will cover <b>both</b> grid cells.</p>
<p>Once I have this setup I just have to give each cell a name. Here's the relevant part of the code from the demo:</p>
<pre>
<code class="language-css">
one {
grid-area: topright;
}
two {
grid-area: middle;
}
three {
grid-area: bottomleft;
}
</code>
</pre>
<p>Make sure you see how these are mapping from the original source so you know that it works. A very nice feature of this is you can change the positions of these tags <b>without</b> changing the HTML. You just give them a new <b>grid-area:</b> name and it will be put in that cell (or cells).</p>

@ -0,0 +1 @@
<p>Most of this demo is done for me with <a href="https://andybrewer.github.io/mvp/">mvp.css</a> and all I'm doing is placing it in a standard flexbox content block. I may redo this using flexbox to demonstrate how to do it better.</p>

@ -0,0 +1,23 @@
<p>Once again we have the common "panel/card/tile" container theme. There's not much new here except for the way I made the buttons take up an entire strip on the bottom:</p>
<pre>
<code class="language-css">
panel bottom {
flex-shrink: 0;
display: flex;
flex-direction: row;
justify-content: space-evenly;
}
panel bottom button {
display: flex;
margin: 0;
border-radius: unset;
width: 100%;
justify-content: space-evenly;
}
</code>
</pre>
<p>The key to this is setting <b>justify-content: space-evenly</b> on the containing <b>panel bottom</b>, then set the width of each button to 100% with <b>width: 100%</b>. There are other ways to force the buttons to max width, but I've found width:100% is the most reliable method.
</p>

@ -0,0 +1,19 @@
<p>Tiles, Cards, Panels, and Sheets all seem to be similar containers with slightly different directional organization. There isn't any official terminology so I went with this being the kind of panel you'd find in Youtube's UI, especially in the comments section and related videos. I've added a couple buttons in the top right to demonstrate how that works, which also means this can function as a toast pattern too if you wanted.
</p>
<p>The key to this UI realizing that it's actually 3 columns, not 2 rows. The first column has the 48x48 image, then the title/content, then the buttons. Since the main tile component already uses a <b>flex-direction: row</b> the 48x48 image will automatically be on the left, and we only need to have CSS for the middle and right. You should also look at this little bit:</p>
<pre>
<code class="language-css">
tile middle {
/* ... */
flex-shrink: 3;
}
tile right {
flex-shrink: 0;
}
</code>
</pre>
<p>Setting <b>flex-shrink: 0</b> sets that column to not shrink (collapse) when it gets small. Without this the buttons would go vertical when the UI is shrunk down. I also found I had to put <b>flex-shrink: 3</b> on the middle component or it would expand as the amount of text increased. This forces it to shrink significantly when possible while keeping the buttons on the right solid.</p>

@ -1 +0,0 @@
<h1>About Page</h1>

@ -31,7 +31,6 @@
</a>
<ul>
<li><a href="/demos" use:link>Demos</a></li>
<li><a href="/about" use:link>About</a></li>
</ul>
</nav>
</header>
@ -44,11 +43,11 @@
<footer>
<nav>
<a href="/" use:link>
<p>Copyright (C) Big Corp.</p>
<p>Copyright (C) Zed A. Shaw. All rights reserved.</p>
</a>
<ul>
<li><Icon name="twitter" size="32" /></li>
<li><Icon name="instagram" size="32" /></li>
<li><a href="https://twitter.com/lzsthw"><Icon name="twitter" size="32" /></a></li>
<li><a href="https://instagram.com/zedshaw"><Icon name="instagram" size="32" /></li>
<li><Darkmode /></li>
</ul>
</nav>

@ -61,4 +61,4 @@
</calendar>
</content>
<CodeView source="/code/Calendar" />
<CodeView source="/code/Calendar" notes="/code/Calendar.notes.html" />

@ -67,4 +67,4 @@
</card>
</content>
<CodeView source="/code/Cards" />
<CodeView source="/code/Cards" notes="/code/Cards.notes.html" />

@ -95,4 +95,4 @@
</icecream>
</content>
<CodeView source="/code/GridOverGraphic" />
<CodeView source="/code/GridOverGraphic" notes="/code/GridOverGraphic.notes.html" />

@ -27,4 +27,4 @@
</content>
<CodeView source="/code/Login" />
<CodeView source="/code/Login" notes="/code/Login.notes.html"/>

@ -77,4 +77,4 @@
</panel>
</content>
<CodeView source="/code/Panels" />
<CodeView source="/code/Panels" notes="/code/Panels.notes.html" />

@ -63,4 +63,4 @@
</tile>
</content>
<CodeView source="/code/Tiles" />
<CodeView source="/code/Tiles" notes="/cdoe/Tiles.notes.html" />

@ -1,6 +1,5 @@
import Home from "./Home.svelte";
import Demos from "./demos/index.svelte";
import About from "./About.svelte";
import NotFound from "./NotFound.svelte";
import Google from "./demos/Google.svelte";
import Twitter from "./demos/Twitter.svelte";
@ -21,7 +20,6 @@ import GridOverGraphic from "./demos/GridOverGraphic.svelte";
export default {
"/": Home,
"/about": About,
"/demos": Demos,
"/demos/login": Login,
"/demos/tiles": Tiles,

Loading…
Cancel
Save