Skip to content

Commit

Permalink
シラバスデータをdataに移動
Browse files Browse the repository at this point in the history
  • Loading branch information
swawa-yu committed Dec 25, 2023
1 parent 86e5622 commit 7a70520
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 7 deletions.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
// initializeSubject, subjectCodeList,
initializeSubject,
} from './subject';
import SyllabusTable from './subject/SyllabusTable';
import SyllabusTableRaw from './subject/SyllabusTableRaw';
import SyllabusTable from './table-view/SyllabusTable';
import SyllabusTableRaw from './table-view/SyllabusTableRaw';
// import { numberOfSubjectsToShow } from './subject/SyllabusTable';


Expand Down
41 changes: 41 additions & 0 deletions src/subject/SearchComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React, { useState } from 'react';

type SearchComponentProps = {
onSearch: (term: string, checkbox: boolean) => void;
};

const SearchComponent: React.FC<SearchComponentProps> = ({ onSearch }) => {
const [searchTerm, setSearchTerm] = useState('');
const [checkboxValue, setCheckboxValue] = useState(false);

const handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setSearchTerm(e.target.value);
};

const handleCheckboxChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setCheckboxValue(e.target.checked);
};

const handleSearch = () => {
onSearch(searchTerm, checkboxValue);
};

return (
<div>
<input
type="text"
value={searchTerm}
onChange={handleSearchChange}
placeholder="検索..."
/>
<input
type="checkbox"
checked={checkboxValue}
onChange={handleCheckboxChange}
/>
<button onClick={handleSearch}>検索</button>
</div>
);
};

export default SearchComponent;
2 changes: 1 addition & 1 deletion src/subject/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// import { Periods } from './period';

import subjectData from '../../subject-maininfo.json'
import subjectData from '../../data/subject-maininfo.json'

export interface kaisetsuki {
rishuNenji: number
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
subjectCodeList,
subjectMap,
// propertyToShowList,
} from './';
} from '../subject';

import './SyllabusTable.css';
import { SearchOptions } from './search';
import { SearchOptions } from '../subject/search';

const fillteredSubjectCodeList = (options: SearchOptions) => {
return subjectCodeList.filter((subjectCode) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
subjectCodeList,
subjectMap,
propertyToShowList,
} from '.';
} from '../subject';

import './SyllabusTable.css';
import { SearchOptions } from './search';
import { SearchOptions } from '../subject/search';

// TODO 要実装
// reactなら元データsearch option 変えるだけでできるんじゃね
Expand Down

0 comments on commit 7a70520

Please sign in to comment.