Skip to content

Commit

Permalink
Merge pull request #17 from swawa-yu/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
swawa-yu authored Apr 2, 2024
2 parents 60375f6 + 3dcb061 commit 7c66ce7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
9 changes: 2 additions & 7 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ function App() {
initializeSubject();

const [searchOptions, setSearchOptions] = useState<SearchOptions>(initialSearchOptions);
const [actualSearchOptions, setActualSearchOptions] = useState<SearchOptions>(initialSearchOptions);

const handleSearch = (newSearchOptions: SearchOptions) => {
setActualSearchOptions(newSearchOptions);
};

// テーマのステートを追加 (デフォルトはシステムの設定に依存)
const [theme, setTheme] = useState(window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
Expand Down Expand Up @@ -67,9 +62,9 @@ function App() {
</ul>
</div>

<SearchComponent onSearch={handleSearch} searchOptions={searchOptions} setSearchOptions={setSearchOptions}></SearchComponent>
<SearchComponent searchOptions={searchOptions} setSearchOptions={setSearchOptions}></SearchComponent>

<TableView searchOptions={actualSearchOptions}></TableView>
<TableView searchOptions={searchOptions}></TableView>

<Timetable></Timetable>

Expand Down
8 changes: 1 addition & 7 deletions src/components/SearchComponent/SearchComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,10 @@ import { kaikouBukyokus, kaikouBukyokuGakubus, kaikouBukyokuDaigakuins } from '.
type SearchComponentProps = {
setSearchOptions: React.Dispatch<React.SetStateAction<SearchOptions>>;
searchOptions: SearchOptions;
onSearch: (newSearchOptions: SearchOptions) => void;
};

// TODO: あいまい検索に対応(generalSearch)
const SearchComponent: React.FC<SearchComponentProps> = ({ searchOptions, onSearch, setSearchOptions }: SearchComponentProps) => {
const handleSearch = () => {
onSearch(searchOptions);
};

const SearchComponent: React.FC<SearchComponentProps> = ({ searchOptions, setSearchOptions }: SearchComponentProps) => {
const handleClear = () => {
setSearchOptions(initialSearchOptions);
};
Expand Down Expand Up @@ -238,7 +233,6 @@ const SearchComponent: React.FC<SearchComponentProps> = ({ searchOptions, onSear
<KomaSelector onSelectionChange={handleYoubiKomaChange} />
</div>
<div className='do-search'>
<button onClick={handleSearch}>検索</button>
<button onClick={handleClear}>検索条件をクリア</button>
</div>
</div >
Expand Down

0 comments on commit 7c66ce7

Please sign in to comment.