interface BaseField {
title?: string;
name?: string;
}
interface Field extends BaseField {
position: number;
orientation: Orientation;
totalSum: boolean;
}
interface ColField {
field: BaseField;
header: string;
...
}
this.colsFields: ColField[] = [
...
];
$('.scroll').on('click', function() {
const blockHeight = 1000;
$('.block-top').animate({height: `${blockHeight}px`},500);
var anchor = $('.anchor');
$('html,body').animate({ scrollTop: anchor.offset().top + blockHeight }, 500);
});
const parser = new DOMParser();
const html = parser.parseFromString( '<div><p>foo</p><p>bar</p></div>' , 'text/html');
const divDoc = html.getRootNode();
document.body.appendChild(divDoc.body);
const doc = h(
'div.block',
{
style: {
height: '200px',
},
},
h('span', 'text', {
style: {
color: 'red',
},
})
);
loadMore = () => {
this.setState(
(prevState) => ({
page: prevState.page + 1,
}),
() => {
const {query, page} = this.state;
window.scrollTo({
top: document.documentElement.scrollHeight,
behavior: 'smooth',
});
fetchImg(query, page).then((response) =>
this.setState((state) => ({
images: [...state.images, ...mapper(response.data.hits)],
}))
);
}
);
};
const App = () => {
const [isTimerActive, setIsTimerActive] = useState(false);
const handleClick = () => {
// активируем счетчик
setIsTimerActive(true);
setTimeout(() => {
// сбрасываем
setIsTimerActive(false);
}, 1000);
};
return (
<button disabled={isTimerActive} onClick={handleClick}>
{isTimerActive ? 'loading...' : 'Повторно отправить смс'}
</button>
);
};
export default App;