princemuel / space-tourism

This is a solution to the Frontend Mentors Space Tourism Project Challenge

Home Page:https://space-tours-fm.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Frontend Mentor - Space tourism website solution

This is a solution to the Space tourism website challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

The challenge

Users should be able to:

  • View the optimal layout for each of the website's pages depending on their device's screen size
  • See hover states for all interactive elements on the page
  • View each page and be able to toggle between the tabs to see new information

Screenshot

Project Screenshot

Links

My process

Built with

  • Semantic and Accessible HTML5 markup
  • CSS custom properties
  • Flexbox
  • CSS Grid
  • Mobile-first workflow
  • Typescript - JavaScript with syntax for types
  • Sass - CSS Preprocessor
  • ViteJS - Modern Javascript Module Bundler

What I learned

<button
  class="text-white ff-serif fs-600"
  role="tab"
  aria-selected="false"
  aria-controls="spaceport-tab"
  data-image="spaceport-image"
  tabindex="-1"
>
  <span class="sr-only">spaceport</span>
  <span aria-hidden="true">2</span>
</button>
@each $screen-size, $property in $type-scale {
  @if $screen-size == small {
    @each $prop, $value in $property {
      .fs-#{$prop} {
        font-size: var(--fs-#{$prop});
      }
    }
  }
}
function getElement<T extends Element>(
  selector: string,
  scope: ParentNode | Document
): T;
function getElement<T extends Element>(
  selector: string,
  scope: ParentNode | Document,
  isElementArray: true
): T[];
function getElement<T extends Element>(
  selector: string,
  scope: ParentNode | Document,
  isElementArray: false
): T;
function getElement<T extends Element>(
  selector: string,
  scope: ParentNode | Document,
  isElementArray?: boolean
): T | T[] {
  try {
    if (isElementArray) {
      const element = [...scope.querySelectorAll(selector)] as T[];
      if (element.length < 1) throw Error;
      return element;
    } else {
      const element = scope.querySelector(selector) as T;
      if (!element) throw Error;
      return element;
    }
  } catch (e) {
    throw new Error(
      `There is an error. Please check if your selector: ${selector} is correct`
    );
  }
}

Continued development

  • Semantic and Accessible HTML5 markup
  • Mobile first workflow
  • Building Design Systems
  • Working with TypeScript

Useful resources

  • MDN: CSS Grids Layout - This is an amazing article which helped me finally understand CSS Grid Layouts. I'd recommend it to anyone still learning this concept.

Author

About

This is a solution to the Frontend Mentors Space Tourism Project Challenge

https://space-tours-fm.netlify.app/


Languages

Language:SCSS 50.0%Language:HTML 44.9%Language:TypeScript 5.1%