Basic UI (User Interface) Properities

Color: Hue, saturation, and brightness for things like background, text, buttons, and more.

Font: Size, weight, style, etc. of the text displayed on the UI.

Layout: This refers to the arrangement/positioning of UI elements such as buttons, images, etc

Icons: Symbols used to represent things in the UI.

Interactivity: Things like clicking, dragging, scrolling, etc.

Accessibility: UI that can be used for people with disabilities, for example, color blindness.

SASS will help us perform these properties at the max...

What is SASS and why is SASS useful for us?

  • SASS stands for syntactically awesome stylesheets.
  • SASS is extremely helpful because it lessens the overall complexity of customization that we get with coding directly with CSS
  • SASS creates a compiler that allows us to write stylesheets with .sass and .scss

What are the differences between all these

  • SCSS includes all CSS features + more
  • CSS is a style language that is used to style and create web pages. While SCSS is a particular type of file for SASS, it used the Ruby language, which assembles the browser's CSS style sheets.
  • SCSS contains advanced and modified features.
  • SCSS is more syntax-oriented than CSS. SCSS uses fewer lines in its code than CSS, which makes programming easier

  • What are coding benefits:

    • SASS has variables that we can use
    • In many cases, classes are used as name spaces, which means they are duplicated over and over again. We can avoid this by nesting styles inside the parent
    • They already have some built in functions for us to use
    • Once your done with the UI, the compiler will take your code and convert it to valid CSS that works
  • What are coding drawbacks:

    • The browser can't read SASS, only CSS. As a result, you must have the "Live Sass Complier" extension installed. This extension will convert SASS to CSS.

Those were the basics ... next is some examples

Examples of SASS: Can you spot what's good about it?

Example 1: Variables - Nathan

$primary-color: #4286F4; // prefix is the cash symbol with a colon 
$secondary-color: #F4A142;

.header {
  background-color: $primary-color;
  color: $secondary-color;
}

.button {
  background-color: $secondary-color;
  color: $primary-color;
}

In this example, we define two variables: $primary-color and $secondary-color. We then use these variables in our styles for the .header and .button classes. By using variables, we can easily change the primary and secondary colors throughout our codebase by simply updating the values of the variables. This can be especially useful for maintaining consistency across a website or application.

Example 2: Nested Styling - Aniket

nav {
  ul {
    margin: 0;
    padding: 0;
    list-style: none;

    li {
      display: inline-block;
      margin: 0 10px;

      a {
        color: #333;
        text-decoration: none;
        padding: 5px;
        border-radius: 5px;

        &:hover {
          background-color: #333;
          color: #fff;
        }
      }
    }
  }
}

In this example, we have a navigation menu (nav) with an unordered list (ul) of menu items (li). We use nesting to define the styles for each level of the menu. For example, the li elements are styled to have display: inline-block and a margin of 0 10px. We then nest another level to style the anchor links (a) within the li elements. Note the use of the & symbol to target the parent element. In this case, we use &:hover to define a hover state for the anchor links within the li elements.

Example 3: Changing Format between devices - Nathan

.container {
  max-width: 960px;
  margin: 0 auto;

  .content {
    padding: 20px;
    background-color: #f9f9f9;
  }

  @media (min-width: 768px) {
    display: flex;
    justify-content: space-between;

    .sidebar {
      width: 30%;
      margin-right: 20px;
    }

    .content {
      width: 70%;
      padding: 40px;
    }
  }
}

In this example, we have a container element with a maximum width of 960 pixels and centered margin. Within the container, we have a content section with a background color and padding. Using a media query with @media (min-width: 768px) we apply some changes when the viewport width is 768 pixels or wider. In this case, we use the display property to switch to a flex layout, with the content and sidebar elements arranged side by side. We then use specific styles for the .sidebar and .content elements to adjust their width and margins. Using media queries like this can help you create responsive layouts that adjust to different devices and screen sizes, improving the user experience on different devices.

Steps To Use SASS In YOUR Fastpages

  1. Install the Sass Live compiler on your machine (most of you probably already do)

  2. Once Sass is installed, you can create Sass files (.scss or .sass) in your Fastpages repository. You can create separate Sass files for different parts of your website, such as layout, typography, colors, etc.

  3. Write Sass code: Write your CSS styles using Sass syntax in your Sass files. Sass will compile your Sass code into standard CSS code that can be understood by web browsers.

  4. Compile Sass to CSS: Compile Sass files into CSS using the Sass compiler. The Sass compiler will generate CSS files from your Sass code, which you can then use in your Fastpages project. You can configure the Sass compiler to output the compiled CSS files to a specific directory, such as _sass or assets/css, so that they can be easily included in your Fastpages site.

  5. Include compiled CSS in your Fastpages: Once you have compiled your Sass files into CSS, you can include the compiled CSS files in your Fastpages project. You can do this by linking to the CSS files in your Jekyll layout or template files, or by including the CSS files directly in your Markdown blog posts using HTML or Markdown syntax.