0.0.6 • Published 2 years ago

govil-accordion v0.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

govil-accordion

A simply component written with TypeScript to present set of

How to use

Clone this repo to your local computer, then run:

  • npm install && npm run build

You can now import govil-button as a normal package installed from npm like so:

import Button from 'govil-button';
...

Available props

//from govil-react-components-models

interface LinkModel {
    
     title: string;
     url: string;
     isExternal: boolean;
}

interface ExpandButtonOptions {    

    isExpanded: boolean;
    showLessTitle: string;
    showMoreTitle: string;
}

interface ButtonModel {
    
     id: string;
     onClickHandler: any;
     isPrimary: boolean;
     disabled: boolean;
     expandOptions?: ExpandButtonOptions | null;
     linkOptions?: LinkModel | null;
}

To customize this component, pass in a viewModel to the vm prop.

// your-component.js
import Button from 'govil-button'

...
const buttonDemo: ButtonModel = {
    id: 'ButtonDemo',
    linkOptions: {
        title: 'next',
        url: '/next',
        isExternal: false
    },
    onClickHandler: () => { },
    disabled: false,
    isPrimary: true
}

<Button vm={buttonDemo} />

<Button vm={{
    ...buttonDemo,
    linkOptions: null,
    expandOptions: {
        isExpanded: false,
        showLessTitle: "Show less",
        showMoreTitle: "Show more"
    },
    disabled: true,
    isPrimary: false
}} />
...

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