File tree Expand file tree Collapse file tree 5 files changed +80
-1
lines changed Expand file tree Collapse file tree 5 files changed +80
-1
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " react-chat-renderer" ,
3
- "version" : " 0.6.11 " ,
3
+ "version" : " 0.6.12 " ,
4
4
"license" : " MIT" ,
5
5
"scripts" : {
6
6
"postversion" : " npm publish" ,
Original file line number Diff line number Diff line change @@ -845,6 +845,39 @@ Object {
845
845
}
846
846
` ;
847
847
848
+ exports [` slack jsx renders an overflow menu 1` ] = `
849
+ Object {
850
+ " accessory" : Object {
851
+ " action_id" : " action1" ,
852
+ " options" : Array [
853
+ Object {
854
+ " text" : Object {
855
+ " emoji" : false ,
856
+ " text" : " option 1" ,
857
+ " type" : " plain_text" ,
858
+ },
859
+ " value" : " value1" ,
860
+ },
861
+ Object {
862
+ " text" : Object {
863
+ " emoji" : false ,
864
+ " text" : " option 2" ,
865
+ " type" : " plain_text" ,
866
+ },
867
+ " value" : " value2" ,
868
+ },
869
+ ],
870
+ " type" : " overflow" ,
871
+ },
872
+ " text" : Object {
873
+ " text" : " This is a section block with an overflow menu." ,
874
+ " type" : " mrkdwn" ,
875
+ " verbatim" : false ,
876
+ },
877
+ " type" : " section" ,
878
+ }
879
+ ` ;
880
+
848
881
exports [` slack jsx renders contextblock children 1` ] = `
849
882
Object {
850
883
" elements" : Array [
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import {
33
33
InputBlock ,
34
34
TimePickerElement ,
35
35
MultiExternalSelectElement ,
36
+ OverflowMenuElement ,
36
37
} from '../components' ;
37
38
38
39
const fakePromise = async ( ) => Promise . resolve ( ) ;
@@ -763,4 +764,31 @@ describe('slack jsx', () => {
763
764
) ;
764
765
expect ( await render ( message ) ) . toMatchSnapshot ( ) ;
765
766
} ) ;
767
+
768
+ it ( 'renders an overflow menu' , async ( ) => {
769
+ const message = (
770
+ < SectionBlock
771
+ accessory = {
772
+ < OverflowMenuElement
773
+ actionId = "action1"
774
+ options = { [
775
+ {
776
+ text : < PlainText > option 1</ PlainText > ,
777
+ value : 'value1' ,
778
+ } ,
779
+ {
780
+ text : < PlainText > option 2</ PlainText > ,
781
+ value : 'value2' ,
782
+ } ,
783
+ ] }
784
+ />
785
+ }
786
+ >
787
+ < MarkdownText >
788
+ This is a section block with an overflow menu.
789
+ </ MarkdownText >
790
+ </ SectionBlock >
791
+ ) ;
792
+ expect ( await render ( message ) ) . toMatchSnapshot ( ) ;
793
+ } ) ;
766
794
} ) ;
Original file line number Diff line number Diff line change
1
+ import { StaticSelect , Overflow } from '@slack/types' ;
2
+ import { FC } from '..' ;
3
+ import { buildInputOptions , InputOption } from './shared/inputOption' ;
4
+
5
+ export interface OverflowMenuElementProps {
6
+ actionId : string ;
7
+ options : InputOption [ ] ;
8
+ }
9
+
10
+ export const OverflowMenuElement : FC < OverflowMenuElementProps , Overflow > = ( {
11
+ actionId,
12
+ options,
13
+ } ) => ( {
14
+ type : 'overflow' ,
15
+ action_id : actionId ,
16
+ ...( options && { options : buildInputOptions ( options ) } ) ,
17
+ } ) ;
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export * from './MultiSelectElement';
20
20
export * from './ExternalSelect' ;
21
21
export * from './Checkbox' ;
22
22
export * from './RadioButtons' ;
23
+ export * from './OverflowMenuElement' ;
23
24
export { InputOption } from './shared/inputOption' ;
24
25
25
26
export * from './PlainText' ;
You can’t perform that action at this time.
0 commit comments