Skip to content

Commit

Permalink
Add module selector hint
Browse files Browse the repository at this point in the history
  • Loading branch information
oamaok committed Oct 17, 2021
1 parent 7e06aa0 commit a43d4cd
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 24 deletions.
7 changes: 7 additions & 0 deletions client/src/components/module-selector/ModuleSelector.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@
margin-bottom: 10px;
flex-grow: 0;
}

.selector-hint {
position: absolute;
bottom: 80px;
left: 50%;
transform: translateX(-50%);
}
53 changes: 29 additions & 24 deletions client/src/components/module-selector/ModuleSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { h, unwrap, useEffect, useRef, useState } from 'kaiku'
import { h, unwrap, useEffect, useRef, useState, Fragment } from 'kaiku'
import classNames from 'classnames/bind'
import styles from './ModuleSelector.css'
import { moduleMap } from '../../moduleMap'
Expand Down Expand Up @@ -57,32 +57,37 @@ const ModuleSelector = () => {
})

return (
<div className={css('module-selector', { open: selectorState.open })}>
<div className={css('filter')}>
Filter
<input
type="text"
ref={filterRef}
value={selectorState.filter}
onInput={(evt) => {
selectorState.filter = evt.target.value
}}
/>
<>
<div className={css('selector-hint')}>
Hit the <b>Enter</b> key to add modules.
</div>
<div className={css('module-list')}>
{moduleNames.map((name) => (
<button
className={css('item')}
onClick={() => {
selectorState.open = false
addModule(name)
<div className={css('module-selector', { open: selectorState.open })}>
<div className={css('filter')}>
Filter
<input
type="text"
ref={filterRef}
value={selectorState.filter}
onInput={(evt) => {
selectorState.filter = evt.target.value
}}
>
{name}
</button>
))}
/>
</div>
<div className={css('module-list')}>
{moduleNames.map((name) => (
<button
className={css('item')}
onClick={() => {
selectorState.open = false
addModule(name)
}}
>
{name}
</button>
))}
</div>
</div>
</div>
</>
)
}

Expand Down

0 comments on commit a43d4cd

Please sign in to comment.