notespage

hello dude, welcome to my

I am

Daniel

a frontend dev

notes

week #1

So... What is this frontend all about?

Well, in short it is what you see and interact with on a website.

We learned, the basics of a basis of HTML and CSS and started using Visual Studio Code.

week #2

We learned about what to use HTML, CSS and JS for and created our first ever website.

Devtools in a browser are suberb, use them more often.

Here you have layers of a website:

  • Layer 3: JavaScript,
  • Layer 2: CSS,
  • Layer 1: HTML,
  • Layer 0: Content.

Every layer have an impact on one another. The highest layer of all can manipulate these lower ones. So JS is like a master of them all, but at the same time it's the hardest to learn. Nothing for free i guess.

CSS is used to make HTML pretty.

HTML is a sceleton of the whole site.

"If we can create something using HTML, we do it in HTML instead of JS"

And the last one is content of the website.

week #3

KANBAN!

We use Trello to have control of what is done and what to do next. There are three general cards:

  • to-do
  • doing
  • done

but there is no problem adding another ones. Just these three are crucial.

Fundamental HTML tags:

  • <header></header> header marker (top part)

  • <main></main> main marker (middle part)

  • <section></section> used to wrap a lot of content

  • <article></article> used to divide section into smaller parts

  • <footer></footer> footer marker (bottom part)

  • <h1-h6></h1-h6> headings (must have in each section)

  • <p></p> paragraph

  • <br> next line
    <br /> can be used s well

  • <b></b> bold

  • <i></i> italic

  • <strong></strong> bold, but with higher importance

  • <em></em> italic, but with higher importance

  • <a href="#" target="_blank"></a>
    link leads to a link or section with href="#"
    and opens in new tab with target="_blank"

  • <nav></nav> is used to create navigation

  • <img src="" alt=""> for images
    to place image use src=""
    and print a text of an image with alt=""

A story about a snake, kebab, camel and Pascal (no need to explain)

  • snake_case
  • kebab-case
  • camelCase
  • PascalCase

Selectors:

  • <p class="one" id="two"> we use classes as many times as we want, but id's should be used once.

  • .one {
    color:
    #434343;
    }

    we use . before classes in CSS

  • #two {
    color:
    #525252;
    }

    we use # before id's in CSS

CSS specificity:

(_, _), _, _, _

Left to right is here top to bottom:

  • !important
  • style=""
  • #name
  • .name
  • element

DOM is the final code rendered on a website.

Terminal:

  • cd - home catalog.

  • ls list catalog content.

  • cd .. go to previous catalog.

  • cd <catalog-name> go to catalog with its catalog-name.

  • code . opens Visual Studio Code in current folder.

  • pwd show current path.

  • mkdir <catalog-name> create new catalog named catalog-name.

week #4

What is Git?

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

Basic Git commands:

  • git config --global user.name "John Miller" setting up global user name on a machine.

  • git config --global user.email jmiller@example.com setting up global user mail on a machine.

  • git init initialize new local repository.

  • git status checks current commit and branch status.

  • git add . adds every file to stage for commiting.

  • git commit -m "description" commits staged changes with a description.

  • git commit -am "description" automatically adds and commits changes with a description.

  • git clone <GitHub repository link> downloads all files from GitHub (remote) repository to machine.

  • git push send commited changes to remote repository.

  • git pull get latest files from remote repository.

New HTML tag:

  • <div></div> is used to wrap some content inside. It doesn't have semantic meaning to it.

New CSS attributes:

  • display: block; sets item width to 100% and stack them one under another.

  • display: inline; stacks items side by side. Unable to use width: and height: properties.

  • display: inline-block; mix between those two. Able to use width: and height: properties.

overflow: properties:

  • visible; default value.

  • hidden; hide text inside container that it's in.

  • scroll; creates scroll bar(s) inside container

  • auto; if content fits the padding-box it behaves the same as visible; and if it doesn't it creates scroll bars.

Units:

  • 0; no need to use units with 0.

  • px; pixels.

  • %; percent. Its value is calculated due to the container height or width that it is in.

  • vh; viewport height is dependent of the browser height.

  • vw; viewport width is dependent of the browser width.

Border in CSS

  • border-width: 3px; border width.

  • border-style: solid; border style.

  • border-color: #434343; border color.

  • border: 3px solid #434343; can be written like that in short.

  • border-radius: 3px; defines edge roundness.

box-sizing: as in the picture below:

box-sizing comparison

position: CSS property sets how an element is positioned in a document:

  • static; default value.

  • relative; The element is positioned according to the normal flow of the document, and then offset relative to itself based on the values of top:, right:, bottom:, and left:. The offset does not affect the position of any other elements; thus, the space given for the element in the page layout is the same as if position were static;

  • absolute; The element is removed from the normal document flow, and no space is created for the element in the page layout. It is positioned relative to its closest positioned ancestor, if any; otherwise, it is placed relative to the initial containing block. Its final position is determined by the values of top:, right:, bottom:, and left:

  • fixed; The element is removed from the normal document flow. Its position is fixed to the viewport and it stays there either we scroll or not.

  • stiky; The element is positioned according to the normal flow of the document, and then offset relative to its nearest scrolling ancestor and containing block.

float: CSS property places an element on the left or right side of its container, allowing text and inline elements to wrap around it. The element is removed from the normal flow of the page, though still remaining a part of the flow.

clear: CSS property sets whether an element must be moved below (cleared) floating elements that precede it. It applies to floating and non-floating elements.

JavaScript variables ES6

  • const name = 'Daniel'; variable that have constant connection between one value. Cannot manipulate these.

  • let job = 'jobless'; variable that doesn't have constant connection between one value. Can manipulate these as shown below.

    • job = 'frontend dev';

    • job = true;

    • job = 23;

JavaScript connection with DOM (Document Object Model)

document. querySelector('.some-text--js').innerHTML = 'Welcome everyone!' ;

innerHTML is used to change content of HTML in specific class chosen in querySelector()

week #5

JS functions

function sum(number) {
number += number;
return number;
}

This is a function declaration (ES5) with number as an input argument. To call this function we use: sum(10);.

This function returns a solution that we can store in a variable like this: const result = sum(10);

Then we can log the result to the console like this: console.log(result); or we can console log called function like this: console.log(sum10); the difference is that in result we stored function result and we can access it later on.

Arrow functions

We can write the same function but in different way using Arrow functions (ES6):

const sum = (number) => (number += number);

<ul></ul> unordered list. Creates lists that is not counted in any way. Dots are defaults.

<ol></ol> ordered list. Creates lists that is counted starting from '1.'.

<li></li> list item. Both <ul> and <ol> have to have list items inside just like that:

<ul>
  • <li>1</li>
  • <li>2</li>
  • <li>3</li>
</ul>
<ol>
  • <li>1</li>
  • <li>2</li>
  • <li>3</li>
</ol>

It is possible to nest lists inside like that:

<ol>
  • <li>1</li>
  • <li>
    <ul>
    • <li>1</li>
    • <li>2</li>
    • <li>3</li>
    </ul>
    </li>
  • <li>3</li>
</ol>

<dl></dl> description list.

<dt></dt> description term.

<dd></dd> description details.

<h2>Monsters in The Witcher 3: Wild Hunt</h2>
<dl>
  • <dt>Ulfhedinn</dt>
  • <dd>Ulfhedinn are a breed of werewolf found mainly in Skellige. The harsh and barren conditions of the isles might explain why they primarily hunt men and are stronger than their continental brethren. Older and particularly dangerous ulfhedinn are called vorefs. Only a few daring warriors in Skellige history have managed to defeat an ulfhedinn, and each of them is commemorated in ballads as a hero to this day.</dd>
  • <dt>Wyvern</dt>
  • <dd>Wyverns are unlucky to be frequently mistaken for dragons. Seeing a reptile approaching a flock of sheep, peasants panic. They expect it to breathe fire, massacre everyone and abduct the local virgins. While it is true that wyverns hunt sheep, they neither breathe fire nor lay waste to whole villages. And they are completely indifferent to virgins.</dd>
</dl>

<table></table> tables. In the past developers tend to use tables to create layouts because of lack of other methods. Creating layout with it now is an occult theme and you should never do that.

  • <caption></caption> table description (optional).
  • <thead></thead> table head.
  • <tr></tr> table row.
  • <th></th> cell in table head.
  • <tbody></tbody> table body.
  • <td></td> table data (cell).
<table>
  • <caption>Table caption</caption>
  • <thead>
      <tr>
      • <th>1st number</th>
      • <th>2nd number</th>
      • <th>3rd number</th>
      </tr>
    </thead>
  • <tbody>
      <tr>
      • <td>5435</td>
      • <td>86456</td>
      • <td>124353</td>
      </tr>
      <tr>
      • <td>56</td>
      • <td>2342</td>
      • <td>76557</td>
      </tr>
    </tbody>
</table>

Flexbox

Flexbox is used to better position elements on a page. It is more convenient to center elements and move them around.

display: flex; creating flexbox in CSS. We can now use something like this:

flex-direction:

  • row
  • column
  • row-reverse
  • column-reverse

Row is from left to right, column is from top to bottom reversed are reversed 😛.

flex-wrap:

  • nowrap
  • wrap
  • wrap-reverse

Wrapping rows / columns.

flex-flow: <flex-direction> <flex-wrap>

Wrapping rows / columns.

justify-content:

  • flex-start
  • flex-end
  • center
  • space-between
  • space-around
  • space-evenly

Positioning elements along the flex-direction axis.

align-content:

  • stretch
  • flex-start
  • flex-end
  • center
  • space-between
  • space-around
  • space-evenly

Positioning rows/columns along the opposite flex-direction axis.

align-items:

  • stretch
  • flex-start
  • flex-end
  • center
  • baseline

Positioning elements along the opposite flex-direction axis.

align-self:

  • stretch
  • flex-start
  • flex-end
  • center
  • baseline

Positioning one element along the opposite flex-direction axis.

order: 0 (integer -/+)

Item order (if greater then element is higher in the hierarchy).

flex-grow: number / proportion

flex-shrink: number / proportion

flex-basis: basic size

flex: <flex-grow> <flex-shrink> <flex-basis>

Background

background-image: url('path to file')

background-position:

  • 0 0
  • <y-position> <x-position>
  • top right
  • bottom left
  • center center
  • xx% xx%
  • xxpx xxpx
  • ... ...

background-repeat:

  • repeat
  • repeat-x
  • repeat-y
  • no-repeat
  • round
  • space%

background-attachment:

  • scroll
  • fixed
  • local

background-origin:

  • padding-box
  • border-box
  • content-box

background-clip:

  • padding-box
  • border-box
  • content-box

background-color: <color value>

background-size:

  • auto
  • cover
  • contain
  • <width> <height>

week #6

JavaScript logic

Comparison signs:

  • > greater than
  • < less than
  • >= greater or equal to
  • <= less or equal to
  • == equality
  • === strict equality (checks typeof)
  • != not equal
  • !== strict not equal (checks typeof)

typeof variable Checks the type of variable. Value types:

Falsy values are the values that will always say false

  • false
  • 0
  • '', "", `` empty string
  • null
  • undefined
  • NaN

Truthy values all the rest 🤘

  • 'Text'
  • 12
  • -3
  • {}
  • []
  • true
  • etc.

&& AND - all conditions must be true

if ((variable === 0) && (newVariable >= 3))

|| OR - at least one condition must be true

if ((variable === 2342) || (newVariable <= 88))

! NOT - switches outcome of the logic statement

if (!(variable === 0 ))

elseexecutes code if in all above statements will be false result

if (myVariable === 4 ) {
//execute code if true
} else {
//execute code if false
}

else if executes code if in all above statements will be false result and in else if the outcome will be true

if (myVariable === 4 ) {
//execute code if true
} else if (myVariable === 8 ) {
//execute code if myVariable === 8
}

Shortend record of the if else statement with ?

(myVariable === 4 ) ? console.log('True') : console.log('False') ;

week #7

week #8

import/export in (s)css

import/export in JavaScript

webpack

week #9

week #10