Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[@mantine/spotlight] Add closeOnTrigger prop to SpotlightAction (#2040)…
… (#2050)
- Loading branch information
1 parent
818d9e0
commit 7c745ea
Showing
6 changed files
with
72 additions
and
1 deletion.
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
43 changes: 43 additions & 0 deletions
43
src/mantine-demos/src/demos/spotlight/Spotlight.demo.actionsCloseOnTrigger.tsx
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,43 @@ | ||
import { SpotlightAction } from '@mantine/spotlight'; | ||
import React from 'react'; | ||
import { Wrapper } from './_wrapper'; | ||
|
||
const code = ` | ||
import { SpotlightProvider, SpotlightAction } from '@mantine/spotlight'; | ||
const onTrigger = () => {}; | ||
const actions: SpotlightAction[] = [ | ||
{ title: 'Will stay open', onTrigger, closeOnTrigger: false }, | ||
{ title: 'Will close', onTrigger, closeOnTrigger: true }, | ||
]; | ||
function Demo() { | ||
return ( | ||
<SpotlightProvider | ||
actions={actions} | ||
searchPlaceholder="Search..." | ||
shortcut="mod + shift + 5" | ||
> | ||
<App /> | ||
</SpotlightProvider> | ||
); | ||
} | ||
`; | ||
|
||
const onTrigger = () => {}; | ||
|
||
const actions: SpotlightAction[] = [ | ||
{ title: 'Will stay open', onTrigger, closeOnTrigger: false }, | ||
{ title: 'Will close', onTrigger, closeOnTrigger: true }, | ||
]; | ||
|
||
function Demo() { | ||
return <Wrapper actions={actions} searchPlaceholder="Search..." shortcut="mod + shift + 5" />; | ||
} | ||
|
||
export const actionsCloseOnTrigger: MantineDemo = { | ||
type: 'demo', | ||
component: Demo, | ||
code, | ||
}; |
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