Astro Hackathon Showcase

🎨 Themes

cognition

by Scott Moore

GitHub Live Preview

README.md

Cognition

Status

Sizable and extensive rework from the initial release, much more of an out-of-the-box starter now.

What It Is

Starter theme for Astro (https://astro.build/) that’s more than a blog, and uses no other frameworks.

  • Accessible, extensible, and responsive navigation system, with optional dropdown system.
  • Fluid typography system that uses the Manrope (https://manropefont.com) variable font.
  • Globally defined meta information, which can be overridden at the page level.
  • Animations that respect reduced-motion preferences.
  • Template files for favicon.ico, favicon.svg, apple-touch-icon.png, and share-image.png (for social sharing).
  • See the Guides & Demos for details about components: https://cognition-theme.netlify.app/guides-and-demos/

Demo Site

https://cognition-theme.netlify.app/

Browser Support

  • Tested in desktop and iOS Chrome, Edge, Firefox, and Safari.

CSS Architecture

It’s opinionated, but opinions based on experience. πŸ‘

Shared styles are imported into /src/styles/global.scss. This file is managed via SASS as a public asset, prevnting it from being bundled with component CSS and allowing the browser to cache it.

Deploy Note: Use yarn build or yarn scss & astro build as the Build Command.

Images

Note that Card images are based on 16:9 ratio, and Author images are based on 1:1 ratio of 225x225.

Typography

In /src/styles/_variables.scss, define the --min-viewport and --max-viewport variables, currently set to 320 and 1440. This is the range within the font will scale. Font sizes are then defined with --min-font-size and --max-font-size.

File Structure

/
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ css/
β”‚   β”œβ”€β”€ fonts/
β”‚   β”œβ”€β”€ img/
β”‚   β”‚   └── generic
β”‚   β”‚   └── global
β”‚   β”‚   └── social
β”‚   β”‚   └── ui
β”‚   └── favicon.ico
β”‚   └── favicon.svg
β”‚   β”œβ”€β”€ robots.txt
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── *.astro
β”‚   β”œβ”€β”€ js/
β”‚   β”‚   └── *.js
β”‚   β”œβ”€β”€ layouts/
β”‚   β”‚   └── *.astro
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   └── *.astro
β”‚   └── styles/
β”‚       └── *.scss
└── package.json
CommandAction
yarn installInstalls dependencies
yarn devStarts local dev server at localhost:3000
yarn buildBuild your production site to ./dist/

Known Issues

  • Announcement scroll effect jitters on Chrome some, if you scroll too fast or change direction fast. This despite using hardware acceleration and throttling.

What Comes Next…Ideally

  • Dynamically generated navigation

Description

A starter theme, and the README (https://github.com/nonsponsored/cognition#readme) outlines what’s included. Had fun with some subtleties, especially in the πŸš€. Hopefully the architectural decisions will be beneficial to others.