govil-strip-g-content
v1.0.0
Published
A strip of single generic content
Downloads
30
Readme
govil-strip-g-content
generic content that get dynamic data
How to use
Clone this repo to your local computer, then run:
npm install && npm run build
You can now import govil-strip-g-content
as a normal package installed from npm like so:
import StripGContent from 'govil-strip-g-content';
...
You can also import the type definitions if you're using TypeScript like so:
import StripGContent, { ComponentModel } from 'govil-strip-g-content';
...
Available props/state Models
interface Model {
vm: ComponentModel;
}
export interface ComponentModel {
title: string
subTitle: string
description: string //html
links: Array<LinkableTitle>
contentId: string //for accessibility
role: string //for accessibility
labelledby: string //for accessibility
resources: {
collapseTitle: string,
expandTitle: string,
}
}
interface IStateModel {
isExpandedLinks: boolean
}
//imported from 'govil-links'
interface LinkableTitle {
title: string,
url: string,
isInternal: boolean
}
To customize this component, pass ComponentModel to the vm
prop.
// your-component.js
import StripGContent, { ComponentModel } from 'govil-strip-g-content';
...
{ this.state.currentStepIndex === index &&
<div className={css.content_container}>
<StripGContent vm={this.state.currentStep} />
</div>
}
...
This component was built for the benefit of the citizens of Israel on behalf of the government, but of course also for the benefit of the OpenSource community and freely published in npm