|
6 | 6 | import '@clayui/css/lib/css/atlas.css';
|
7 | 7 | import ClayButton, {ClayButtonWithIcon} from '@clayui/button';
|
8 | 8 | const spritemap = require('@clayui/css/lib/images/icons/icons.svg');
|
| 9 | +import ClayModal, {useModal} from '@clayui/modal'; |
9 | 10 | import {boolean, select} from '@storybook/addon-knobs';
|
10 | 11 | import {storiesOf} from '@storybook/react';
|
11 | 12 | import React from 'react';
|
@@ -102,4 +103,81 @@ storiesOf('Components|ClayPopover', module)
|
102 | 103 | </ClayPopover>
|
103 | 104 | </>
|
104 | 105 | );
|
| 106 | + }) |
| 107 | + .add('popover w/ recalculate position', () => { |
| 108 | + const [visible, setVisible] = React.useState(false); |
| 109 | + const {observer, onClose} = useModal({ |
| 110 | + onClose: () => setVisible(false), |
| 111 | + }); |
| 112 | + |
| 113 | + return ( |
| 114 | + <> |
| 115 | + {visible && ( |
| 116 | + <ClayModal |
| 117 | + observer={observer} |
| 118 | + size="lg" |
| 119 | + spritemap={spritemap} |
| 120 | + status="info" |
| 121 | + > |
| 122 | + <ClayModal.Header>{'Title'}</ClayModal.Header> |
| 123 | + <ClayModal.Body scrollable> |
| 124 | + <ClayPopover |
| 125 | + header="Popover" |
| 126 | + trigger={ |
| 127 | + <ClayButtonWithIcon |
| 128 | + aria-label="Information button" |
| 129 | + displayType="secondary" |
| 130 | + spritemap={spritemap} |
| 131 | + symbol="info-circle-open" |
| 132 | + /> |
| 133 | + } |
| 134 | + > |
| 135 | + {`Viennese flavour cup eu, percolator froth ristretto mazagran |
| 136 | + caffeine. White roast seasonal, mocha trifecta, dripper caffeine |
| 137 | + spoon acerbic to go macchiato strong. Viennese flavour cup eu, percolator froth ristretto mazagran |
| 138 | + caffeine. White roast seasonal, mocha trifecta, dripper caffeine |
| 139 | + spoon acerbic to go macchiato strong. Viennese flavour cup eu, percolator froth ristretto mazagran |
| 140 | + caffeine. White roast seasonal, mocha trifecta, dripper caffeine |
| 141 | + spoon acerbic to go macchiato strong. Viennese flavour cup eu, percolator froth ristretto mazagran |
| 142 | + caffeine. White roast seasonal, mocha trifecta, dripper caffeine |
| 143 | + spoon acerbic to go macchiato strong.`} |
| 144 | + </ClayPopover> |
| 145 | + <br /> |
| 146 | + <img |
| 147 | + alt="cat" |
| 148 | + src="https://cataas.com/cat/says/it will have" |
| 149 | + /> |
| 150 | + <img |
| 151 | + alt="cat" |
| 152 | + src="https://cataas.com/cat/says/a scroll" |
| 153 | + /> |
| 154 | + </ClayModal.Body> |
| 155 | + <ClayModal.Footer |
| 156 | + first={ |
| 157 | + <ClayButton.Group spaced> |
| 158 | + <ClayButton displayType="secondary"> |
| 159 | + {'Secondary'} |
| 160 | + </ClayButton> |
| 161 | + <ClayButton displayType="secondary"> |
| 162 | + {'Secondary'} |
| 163 | + </ClayButton> |
| 164 | + </ClayButton.Group> |
| 165 | + } |
| 166 | + last={ |
| 167 | + <ClayButton onClick={onClose}> |
| 168 | + {'Primary'} |
| 169 | + </ClayButton> |
| 170 | + } |
| 171 | + /> |
| 172 | + </ClayModal> |
| 173 | + )} |
| 174 | + |
| 175 | + <ClayButton |
| 176 | + displayType="primary" |
| 177 | + onClick={() => setVisible(true)} |
| 178 | + > |
| 179 | + {'Open modal'} |
| 180 | + </ClayButton> |
| 181 | + </> |
| 182 | + ); |
105 | 183 | });
|
0 commit comments