security-checklist/components/ChecklistItem/Heading.js

27 lines
650 B
JavaScript
Raw Permalink Normal View History

2019-01-13 07:00:23 +00:00
// @flow
import React from 'react';
import { Title, Uncollapse } from './style';
2019-01-13 07:00:23 +00:00
import type { ChecklistResource } from '../../types';
type Props = {
resource: ChecklistResource,
2019-01-13 23:55:19 +00:00
isCollapsed: boolean,
2019-01-14 00:02:22 +00:00
handleCollapse: Function,
2019-01-13 07:00:23 +00:00
};
2019-01-14 00:02:22 +00:00
export const Heading = ({ resource, isCollapsed, handleCollapse }: Props) => (
2019-01-13 07:00:23 +00:00
<React.Fragment>
2019-01-14 00:02:22 +00:00
<Title>
{resource.title}
<Uncollapse
onClick={handleCollapse}
aria-controls={`content_${resource.id}`}
aria-expanded={!isCollapsed}
2019-02-06 17:55:22 +00:00
type="button"
>
2019-01-14 00:02:22 +00:00
{isCollapsed ? 'Show details' : 'Hide details'}
</Uncollapse>
</Title>
2019-01-13 07:00:23 +00:00
</React.Fragment>
);