���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /proc/self/cwd/usr/lib/node_modules/npm/docs/src/components/ |
import React from 'react' import styled from 'styled-components' import downCarrot from '../images/down-carrot.svg' import upCarrot from '../images/up-carrot.svg' const SectionButton = styled.button` outline: none; background-color: transparent; cursor: pointer; color: red; border: none; font-size: 18px; font-weight: bold; padding: 5px 0; transition: opacity .5s; &:after { background: center / contain no-repeat url(${(props) => props.isOpen ? upCarrot : downCarrot}); content: ''; height: 11px; width: 28px; display: inline-block; } &:hover { opacity: .6; } ` class Accordion extends React.Component { constructor (props) { super(props) this.state = { isOpen: true } this.onHide = this.onHide.bind(this) } onHide () { this.setState({isOpen: !this.state.isOpen}) } render () { return ( <div> <SectionButton isOpen={this.state.isOpen} onClick={this.onHide}>{this.props.section}</SectionButton> {this.state.isOpen && <div> {this.props.children} </div> } </div> ) } } export default Accordion