export default class MainBlock extends React.Component {
handleClick = () => {
this.props.setActive(this.props.data.id)
}
render() {
return (
<div>
<div >
{this.props.data.question}
<button onClick={this.handleClick} >свернуть</button>
<div style={{display: (this.props.active ? 'block' : 'none')}} className="wrap-full-txt">
{this.props.data.answer}
</div>
</div>
</div>
)
}
}
export default class FAQ extends React.Component {
constructor(props) {
super(props);
this.state = {
stateAnswer: true ,
activeId: ""
}
}
setActive = id => { this.setState({ activeId: id, stateAnswer: !this.state.stateAnswer }) }
render(){
return (
<div>
{faqList.map( data =>
<MainBlock data={data} active={data.id === this.state.activeId} setActive={this.setActive} stateAnswer={this.state.stateAnswer}/>
)}
</div>
)
}
}
export default class MainBlock extends React.Component {
handleClick = () => {
this.props.setActive(this.props.data.id)
}
render() {
return (
<div>
<div className="wrap-full-txt">
{this.props.data.question}
<button onClick={this.handleClick} className="more-full">свернуть</button>
<div style={{display: (this.props.stateAnswer ? 'none' : 'block')}} className="wrap-full-txt">
{this.props.data.answer}
</div>
</div>
</div>
)
}
}
export default class BaseHttpService {
BASE_URL = 'http://localhost:3000';
<?php
echo '<div>';
if($page > 1)
{
echo '<a href="/citys.php?id='. (int) $_GET['id'] .'&page='.($page - 1).'">предыдущая страница </a>';
}
if($page < $total_pages)
{
echo '<a href="/citys.php?id='. (int) $_GET['id'] .'&page='.($page + 1).'; "> следующая страница</a>';
}
echo '</div>';
?>
$total_country_id_q = mysqli_query($con, "SELECT COUNT(`id`) AS `total_count` FROM `citys` WHERE `country_id` = " . (int) $_GET['id']);