diff --git a/components/Element.tsx b/components/Element.tsx index 7e85c6d..1fe55f3 100644 --- a/components/Element.tsx +++ b/components/Element.tsx @@ -1,7 +1,6 @@ -import React from 'react' import Link from 'next/link' +import React from 'react' import { ChevronRight } from 'react-feather' -import next from 'next' interface Props { title: string @@ -12,7 +11,7 @@ interface Props { } const months = [ - "le 13eme mois", + 'le 13eme mois', 'Janvier', 'Février', 'Mars', @@ -24,16 +23,13 @@ const months = [ 'Septembre', 'Octobre', 'Novembre', - 'Décembre' + 'Décembre', ] export default class Element extends React.Component { - constructor(props: Props) { - super(props) - } - render() { + public render() { let date = this.props.date - if (typeof this.props.date === "string") { + if (typeof this.props.date === 'string') { date = new Date(this.props.date) } const t = `${date.getDate()} ${months[date.getMonth()]} ${date.getFullYear()}` diff --git a/components/Filters.tsx b/components/Filters.tsx index 945a884..db6de77 100644 --- a/components/Filters.tsx +++ b/components/Filters.tsx @@ -1,11 +1,12 @@ -import React from 'react' import Link from 'next/link' -import '../styl/styl.styl' -import { ChevronRight, ChevronDown } from 'react-feather' +import React from 'react' +import { ChevronDown, ChevronRight } from 'react-feather' + import config from '../config' +import '../styl/styl.styl' interface Props { - categories?: string[] + categories?: Array onQuery?: (query: string, sort?: boolean) => void onHeight?: (height: number) => void } @@ -17,40 +18,9 @@ interface States { export default class Filters extends React.Component { - private aside = undefined private input = undefined - constructor(props: Props) { - super(props) - } - - setInput = element => { - this.input = element - } - - onKeyDown = (ev: React.KeyboardEvent) => { - setTimeout(() => { - this.submit() - }, 1); - } - - onClick = () => { - if (this.input.value !== "") { - this.submit() - return - } - this.input.focus() - } - - onChange = (ev) => { - this.submit(ev.target.value === "true") - } - - submit = (sort?: boolean) => { - if (this.props.onQuery) this.props.onQuery(this.input.value, sort) - } - - render() { + public render() { return (