Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor timeline macro for compatibility with Jinja2 templates #3180

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/components/timeline/_macro-options.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
| Name | Type | Required | Description |
| -------- | ---------------------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
| classes | string | false | Classes to add to the component |
| titleTag | string | false | The HTML heading tag to wrap the title text in for it’s correct semantic order on the page. Will default to an `h2`. |
| items | array`<TimelineItems>` | true | An array of [timeline items](#timelineitems) |
| Name | Type | Required | Description |
| -------------- | ---------------------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
| classes | string | false | Classes to add to the component |
| titleTag | string | false | The HTML heading tag to wrap the title text in for it’s correct semantic order on the page. Will default to an `h2`. |
| items_timeline | array`<TimelineItems>` | true | An array of [timeline items](#timelineitems) |

rmccar marked this conversation as resolved.
Show resolved Hide resolved
## TimelineItems

Expand Down
2 changes: 1 addition & 1 deletion src/components/timeline/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<div class="ons-timeline{{ ' ' + params.classes if params.classes else '' }}">
{% set titleTag = params.titleTag | default("h2") %}
{% for item in params.items %}
{% for item in params.items_timeline %}
<div class="ons-timeline__item">
<{{ titleTag }} class="ons-timeline__heading">{{ item.heading }}</{{ titleTag }}>
{% if item.itemsList %}
Expand Down
2 changes: 1 addition & 1 deletion src/components/timeline/_macro.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import axe from '../../tests/helpers/axe';
import { renderComponent, templateFaker } from '../../tests/helpers/rendering';

const EXAMPLE_TIMELINE = {
items: [
items_timeline: [
{
heading: 'January 2020',
content: 'Timeline entry 1',
Expand Down
2 changes: 1 addition & 1 deletion src/components/timeline/example-timeline.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{{
onsTimeline({
"items": [
"items_timeline": [
{
"heading": 'September to October 2020',
"itemsList": [
Expand Down
Loading