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.
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
- Solution URL: View Repository
- Live Site URL: View Site
- 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
<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`
);
}
}
- Semantic and Accessible HTML5 markup
- Mobile first workflow
- Building Design Systems
- Working with TypeScript
- 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.
- Frontend Mentor - @pHoeniX-svg
- Twitter - @princemuel_cs
- Github - @pHoeniX-svg