Work in Progress

This library is still a work in progress and things will likely change.

Nova by Resknow

Opening Times

Component Misc
Preview

OpeningTimes

  • Monday

    09:00 - 17:00

  • Tuesday

    09:00 - 17:00

  • Wednesday

    09:00 - 17:00

  • Thursday

    09:00 - 17:00

  • Friday

    09:00 - 17:00

  • Saturday

    Closed

  • Sunday

    Closed

This component is available with our Astro Starter Kit.

Usage

Before you use this component, be sure that you’ve added the opening times to src/site.js in the following format:

export default {
	...otherConfig,

	/**
	 * Opening Times
	 */
	openingTimes: {
		mon: '09:00 - 17:00',
		tue: '09:00 - 17:00',
		wed: '09:00 - 17:00',
		thu: '09:00 - 17:00',
		fri: '09:00 - 17:00',
		sat: 'Closed',
		sun: 'Closed',
	},
};

Now you can import the component into the page or component you need it and use it!

---
import OpeningTimes from '@components/OpeningTimes.astro';
---
<OpeningTimes />

The current day of the week will be highlighted. To change the styling, you can edit the OpeningTimes.astro file. The class applied is on line 24:

x-bind:class={`{ 'font-bold': today === '${day}' }`}