Skip to content

Commit

Permalink
chore: small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Jul 3, 2023
1 parent 395b558 commit a488721
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/toolbar/react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@ export const LunaToolbarSelect: FC<IToolbarSelectProps> = (props) => {
return null
}

interface IToolbarInputProps extends IToolbarItemProps {
key: string
value: string
placeholder?: string
}

export const LunaToolbarInput: FC<IToolbarInputProps> = (props) => {
useEffect(() => {
if (props.toolbar) {
props.toolbar.appendInput(props.key, props.value, props.placeholder)
}
}, [props.toolbar])

return null
}

export const LunaToolbarSeparator: FC<IToolbarItemProps> = (props) => {
useEffect(() => {
if (props.toolbar) {
Expand Down
2 changes: 2 additions & 0 deletions src/toolbar/story.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import LunaToolbar, {
LunaToolbarSelect,
LunaToolbarSeparator,
LunaToolbarSpace,
LunaToolbarInput,
} from './react'

const def = story(
Expand Down Expand Up @@ -57,6 +58,7 @@ const def = story(
}}
/>
<LunaToolbarSeparator />
<LunaToolbarInput key="filter" value="" placeholder="Filter" />
<LunaToolbarSpace />
<LunaToolbarText text="Status: OK" />
</LunaToolbar>
Expand Down

0 comments on commit a488721

Please sign in to comment.