App.tsx 840 Bytes
Newer Older
Zac Wood's avatar
Zac Wood committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
import * as React from 'react';
import Section from '../section';
import SectionList from './SectionList';
import Search from './Search';

interface State {
    currentSchedule: Section[];
}

class App extends React.Component<any, State> {
    constructor(props: any) {
        super(props);
        this.state = { currentSchedule: [] };

        this.addSectionToCurrentSchedule = this.addSectionToCurrentSchedule.bind(this);
    }

    addSectionToCurrentSchedule(section: Section) {
        this.setState({
            currentSchedule: [...this.state.currentSchedule, section],
        });
    }

    render() {
        return (
            <div>
                <h1>Schedules</h1>
                <Search />
                <SectionList sections={this.state.currentSchedule} />
            </div>
        );
    }
}
export default App;