Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
42 changes: 42 additions & 0 deletions packages/ncids-twig/components/nci-card/nci-card.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{#
Inputs:
{
label: string,
title: string,
description: string,
img_4x3: string,
img_16x9: string,
img_alt: string,
href: string
}
#}

{# todo defaults #}
{% set params = {
label: "Feature Card",
title: "CRCHD Diversity Training",
description: "Treatment for severe COVID-19 with interferons decreased the viral load of SARS-CoV-2, a new study found.",
img_alt: "An official website of the United States government",
img_4x3: "Official government website",
img_16x9: "Español"
} %}

{# todo title slug #}
{% set slug = title|lower %}

<div id="nci-card" class="grid-container">
<div class="nci-card tablet-lg:grid-col-4">
<a href="{{ href }}" aria-labelledby="{{ slug }}">
<picture class="nci-card__image">
<source media="(min-width: 880px)" srcset="{{ img_4x3 }}">
<img src="{{ img_16x9 }}" alt="{{ img_alt }}">
</picture>
<div class="nci-card__body">
<span class="nci-card__title" id="{{ slug }}">{{ title }}</span>
{% if description %}
<p class="nci-card__description">{{ description }}</p>
{% endif %}
</div>
</a>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
import React from 'react';
import { TestCase } from '../../../components/test-case';
import css from './nci-card.scss';
Expand Down Expand Up @@ -89,3 +90,4 @@ const html = `
export const CardInTextLeft = () => (
<TestCase css={css} html={html} />
);
*/
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
import React from 'react';
import { TestCase } from '../../../components/test-case';
import css from './nci-card.scss';
Expand Down Expand Up @@ -89,3 +90,4 @@ const html = `
export const CardInTextRight = () => (
<TestCase css={css} html={html} />
);
*/
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
import React from 'react';
import { TestCase } from '../../../components/test-case';
import css from './nci-card.scss';
Expand Down Expand Up @@ -80,3 +81,4 @@ const html = `
`;

export const CardRow = () => <TestCase css={css} html={html} />;
*/
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
import React from 'react';
import { TestCase } from '../../../components/test-case';
import css from './nci-card.scss';
Expand Down Expand Up @@ -39,3 +40,4 @@ const html = `
`;

export const Default = () => <TestCase css={css} html={html} />;
*/
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
import React from 'react';
import { TestCase } from '../../../components/test-case';
import Component from '@nciocpl/ncids-twig/components/nci-card/nci-card.twig';
import css from './nci-card.scss';

import img_4x3 from './img/news1-4x3.jpg';
import img_16x9 from './img/news1-16x9.jpg';

export default {
title: 'components/nci-card',
argTypes: {},
};

export * from './default.stories';
export * from './card-row.stories';
export * from './card-in-text-right.stories';
export * from './card-in-text-left.stories';
const Template = (args) => Component(args);

export const Default = () => <TestCase css={css} html={Template.bind({})(
{
label: 'Feature Card',
title: 'CRCHD Diversity Training',
description: 'Treatment for severe COVID-19 with interferons decreased the viral load of SARS-CoV-2, a new study found.',
img_4x3: img_4x3,
img_16x9: img_16x9,
},
)} />;