Skip to content

Commit

Permalink
release(toolbar): v0.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
surunzi committed Aug 28, 2023
1 parent 547fc04 commit e744fd8
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion index.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@
},
"toolbar": {
"react": true,
"version": "0.4.1",
"version": "0.4.2",
"style": true,
"icon": false,
"test": true,
Expand Down
8 changes: 4 additions & 4 deletions src/toolbar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ toolbar.appendText('Test')

## Api

### appendHtml(html: string | HTMLElement): ToolbarHtml
### appendHtml(html: string | HTMLElement): LunaToolbarHtml

Append html.

### appendInput(key: string, value: string, placeholder?: string): ToolbarInput

Append text input.

### appendSelect(key: string, value: string, options: PlainObj<string>): ToolbarSelect
### appendSelect(key: string, value: string, options: PlainObj<string>): LunaToolbarSelect

Append select.

Expand All @@ -55,14 +55,14 @@ Append separator.

Append item that fills the remaining space.

### appendText(text: string): ToolbarText
### appendText(text: string): LunaToolbarText

Append text.

### clear(): void

Clear all.

### remove(item: ToolbarItem): void
### remove(item: LunaToolbarItem): void

Remove item.
2 changes: 1 addition & 1 deletion src/toolbar/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "toolbar",
"version": "0.4.1",
"version": "0.4.2",
"description": "Application toolbar",
"luna": {
"react": true
Expand Down
17 changes: 11 additions & 6 deletions src/toolbar/react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
cloneElement,
Children,
ReactElement,
isValidElement,
} from 'react'
import types from 'licia/types'
import Toolbar, {
Expand Down Expand Up @@ -39,11 +40,13 @@ const LunaToolbar: FC<PropsWithChildren<IToolbarProps>> = (props) => {

return (
<div className={props.className || ''} ref={toolbarRef}>
{Children.map(props.children, (child) =>
cloneElement(child as ReactElement, {
toolbar: toolbar.current,
})
)}
{Children.map(props.children, (child) => {
if (isValidElement(child)) {
return cloneElement(child as ReactElement, {
toolbar: toolbar.current,
})
}
})}
</div>
)
}
Expand Down Expand Up @@ -150,7 +153,9 @@ export const LunaToolbarSpace: FC<IToolbarItemProps> = (props) => {
return null
}

export const LunaToolbarHtml: FC<PropsWithChildren<IToolbarItemProps>> = (props) => {
export const LunaToolbarHtml: FC<PropsWithChildren<IToolbarItemProps>> = (
props
) => {
const toolbarHtml = useRef<ToolbarHtml>()
const forceUpdate = useForceUpdate()

Expand Down
1 change: 1 addition & 0 deletions src/toolbar/story.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const def = story(
Loading
</span>
</LunaToolbarHtml>
{null}
<LunaToolbarText text="Status: OK" />
</LunaToolbar>
)
Expand Down

0 comments on commit e744fd8

Please sign in to comment.