diff --git a/README.md b/README.md index 680c4f2..d46583b 100644 --- a/README.md +++ b/README.md @@ -10,16 +10,26 @@ This website is built using [Eleventy](https://www.11ty.dev). ## The Code -The components loop through the `fitness.json` dataset. +There are two main web components; a ring and a fully featured card. -Each component expects a JSON payload shape that looks like the following. +```html + + + + + +``` + +In this 11ty codebase, the components loop through the `fitness.json` dataset. + +Each card component expects JSON data that looks like the following. ```json { "date": "2023-09-25T00:00:00+00:00", - "step_count": 18935, + "steps": 18935, "distance": 16254, - "flights_climbed": 8, + "flights": 8, "move": { "total": 500, "goal": 750 diff --git a/src/_data/example.json b/src/_data/example.json index d470736..ac69337 100644 --- a/src/_data/example.json +++ b/src/_data/example.json @@ -1,8 +1,8 @@ { "date": "2023-09-25T00:00:00+00:00", - "step_count": 18935, + "steps": 18935, "distance": 16254, - "flights_climbed": 8, + "flights": 8, "move": { "total": 500, "goal": 750 diff --git a/src/_data/fitness.json b/src/_data/fitness.json index 5cc9423..5f13c93 100644 --- a/src/_data/fitness.json +++ b/src/_data/fitness.json @@ -2,9 +2,9 @@ "data": [ { "date": "2023-09-25T00:00:00+00:00", - "step_count": 18935, + "steps": 18935, "distance": 16254, - "flights_climbed": 8, + "flights": 8, "move": { "total": 500, "goal": 750 @@ -20,9 +20,9 @@ }, { "date": "2023-09-26T00:00:00+00:00", - "step_count": 10639, + "steps": 10639, "distance": 8964, - "flights_climbed": 5, + "flights": 5, "move": { "total": 838, "goal": 650 @@ -35,6 +35,24 @@ "total": 16, "goal": 12 } + }, + { + "date": "2023-09-27T00:00:00+00:00", + "steps": 700, + "distance": 1200, + "flights": 3, + "move": { + "total": 412, + "goal": 650 + }, + "exercise": { + "total": 12, + "goal": 30 + }, + "stand": { + "total": 12, + "goal": 12 + } } ] } diff --git a/src/components/card.njk b/src/components/card.njk index a5a12b1..90467f7 100644 --- a/src/components/card.njk +++ b/src/components/card.njk @@ -1,9 +1,9 @@ -
-
+ + {% renderFile './src/components/header.njk', { date: date } %} -
+ -
+
{% renderFile './src/components/details.njk', { move: move, exercise: exercise, stand: stand } %}
@@ -11,9 +11,9 @@
{% renderFile './src/components/ring.njk', { move: move, exercise: exercise, stand: stand } %}
-
+ -
- {% renderFile './src/components/footer.njk', { steps: step_count, distance: distance, flights: flights_climbed } %} -
-
+ + {% renderFile './src/components/footer.njk', { steps: steps, distance: distance, flights: flights } %} + + diff --git a/src/components/ring.njk b/src/components/ring.njk index 26f1423..b497b7a 100644 --- a/src/components/ring.njk +++ b/src/components/ring.njk @@ -1,21 +1,24 @@ + + + + + + - - - - - + + + + - - - - + + + + - - - - - - {% svg 'move', { width: 2, height: 2, x: 17, y: 1, class: 'stroke-white fill-white @apply animate-pulse-once' } %} - {% svg 'exercise', { width: 2, height: 2, x: 17, y: 5, class: 'stroke-white fill-white @apply animate-pulse-once' } %} - {% svg 'stand', { width: 2, height: 2, x: 17, y: 9, class: 'stroke-white fill-white @apply animate-pulse-once' } %} - + {% if true if showIcons else true %} + {% svg 'move', { width: 2, height: 2, x: 17, y: 1, class: 'stroke-white fill-white @apply animate-pulse-once' } %} + {% svg 'exercise', { width: 2, height: 2, x: 17, y: 5, class: 'stroke-white fill-white @apply animate-pulse-once' } %} + {% svg 'stand', { width: 2, height: 2, x: 17, y: 9, class: 'stroke-white fill-white @apply animate-pulse-once' } %} + {% endif %} + + diff --git a/src/index.njk b/src/index.njk index 8dcca58..19221b7 100644 --- a/src/index.njk +++ b/src/index.njk @@ -7,22 +7,34 @@

{{ site.summary }}

-
+

The Code

-

+

You can download the repository of this project - and setup your own components. - Each component expects a JSON payload shape that looks like the following. + and configure your `fitness.json` data to generate cards and rings. The code in the repository has been organised into + different nunjuck components for easiser compartmentalisation.

+

There are two main web components; a ring and a fully featured card.

+ + {% highlight 'html' %} + + + + + + {% endhighlight %} + +

Each card component expects JSON data that looks like the following.

+ {% highlight 'json' %} {{ example | stringify | safe }} {% endhighlight %}
-
+

Cards

    @@ -34,26 +46,26 @@
-
+

Rings

    {% for item in fitness.data %} -
  • +
  • {% renderFile './src/components/ring.njk', item %}
  • -
  • +
  • {% renderFile './src/components/ring.njk', item %}
  • -
  • +
  • {% renderFile './src/components/ring.njk', item %}
  • {% endfor %}
-
    +
      {% for item in fitness.data %} -
    • +
    • {% renderFile './src/components/ring.njk', item %}
    • {% endfor %}