Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add MoreLinkRoot, strip out current method for opening MorePopover
- Loading branch information
Showing
12 changed files
with
146 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { createElement } from '../vdom' | ||
import { ViewApi } from '../ViewApi' | ||
import { ViewContext, ViewContextType } from '../ViewContext' | ||
import { MountArg, RenderHook, RenderHookPropsChildren } from './render-hook' | ||
|
||
export interface MoreLinkRootProps { // what the MoreLinkRoot component receives | ||
moreCnt: number | ||
buildMoreLinkText: (moreCnt: number) => string | ||
children: RenderHookPropsChildren | ||
} | ||
|
||
export interface MoreLinkContentArg { // what the render-hooks receive | ||
num: number | ||
text: string | ||
view: ViewApi | ||
} | ||
|
||
export type MoreLinkMountArg = MountArg<MoreLinkContentArg> | ||
|
||
export const MoreLinkRoot = (props: MoreLinkRootProps) => ( | ||
<ViewContextType.Consumer> | ||
{(context: ViewContext) => { | ||
let { viewApi, options } = context | ||
let hookProps: MoreLinkContentArg = { | ||
num: props.moreCnt, | ||
text: props.buildMoreLinkText(props.moreCnt), | ||
view: viewApi, | ||
} | ||
|
||
return ( | ||
<RenderHook<MoreLinkContentArg> | ||
hookProps={hookProps} | ||
classNames={options.moreLinkClassNames} | ||
content={options.moreLinkContent} | ||
defaultContent={renderMoreLinkInner} | ||
didMount={options.moreLinkDidMount} | ||
willUnmount={options.moreLinkWillUnmount} | ||
> | ||
{(rootElRef, customClassNames, innerElRef, innerContent) => props.children( | ||
rootElRef, ['fc-event-more'].concat(customClassNames), innerElRef, innerContent, | ||
)} | ||
</RenderHook> | ||
) | ||
}} | ||
</ViewContextType.Consumer> | ||
) | ||
|
||
function renderMoreLinkInner(props) { | ||
return props.text | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.