-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Position, Modal, Options components (#116)
* first commit position * option scroll auto * fix options * update loki * Update packages/fuselage/src/components/Box/Position/index.js Co-Authored-By: Tasso Evangelista <tasso.evangelista@rocket.chat> * Update index.js * position * wip modal * Modal * feat: Modal (#117) * fix modal * Modal, uikit overflow * update loki * test * finish * sad * fix context component * fiz text * more parsers * improve modal scrolling * Update packages/fuselage-ui-kit/src/Actions.js Co-Authored-By: Tasso Evangelista <tasso.evangelista@rocket.chat> * Update AutoComplete stories * fix scroll by keyboard * update references * Add missing loki stories * Refactor Modal * Fix some Modal props and docs * update references * Refactor Modal.Stack * Disable animations when running Loki * Refactor AnimatedVisibility * Refactor Flex * Refactor Margins * fix position * fix margins * Use classes on Flex * Format JSX * fix animated class * loki update * Add Scrollable stories * Remove Position stories * Remove unused Loki references Co-authored-by: Tasso Evangelista <tassoevan7@gmail.com>
- Loading branch information
Showing
117 changed files
with
15,526 additions
and
641 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react'; | ||
import { | ||
Modal, | ||
ButtonGroup, | ||
Button, | ||
AnimatedVisibility, | ||
} from '@rocket.chat/fuselage'; | ||
|
||
const thumb = 'data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=='; | ||
export const Demo = ({ children, visible }) => <AnimatedVisibility visibility={visible}><Modal open={visible}> | ||
<Modal.Header><Modal.Thumb url={thumb}/> <Modal.Title>Modal Header</Modal.Title><Modal.Close/></Modal.Header> | ||
<Modal.Content>{children}</Modal.Content> | ||
<Modal.Footer> | ||
<ButtonGroup align='end'> | ||
<Button>Cancel</Button> | ||
<Button primary>Submit</Button> | ||
</ButtonGroup> | ||
</Modal.Footer> | ||
</Modal></AnimatedVisibility>; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React, { useRef } from 'react'; | ||
import { | ||
AnimatedVisibility, | ||
Button, | ||
PositionAnimated, | ||
Options, | ||
Icon, | ||
useCursor, | ||
} from '@rocket.chat/fuselage'; | ||
|
||
const convertOptions = (options, parser) => options.map(({ text, value }) => [value, parser(text)]); | ||
export const Overflow = ({ options, parser, onChange = console.log }) => { | ||
const handleSelection = ([value]) => onChange({ target: { value } }); | ||
const convertedOptions = convertOptions(options, parser.text); | ||
const [cursor, handleKeyDown, handleKeyUp, , [visible, hide, show]] = useCursor(-1, convertedOptions, (args, [, hide]) => { | ||
handleSelection(args); | ||
hide(); | ||
}); | ||
const ref = useRef(); | ||
return ( | ||
<> | ||
<Button | ||
ref={ref} | ||
small | ||
ghost onClick={show} | ||
onBlur={hide} | ||
onKeyUp={handleKeyUp} | ||
onKeyDown={handleKeyDown} | ||
> | ||
<Icon name='menu' size={20} /> | ||
</Button> | ||
<PositionAnimated | ||
width='auto' | ||
visible={visible ? AnimatedVisibility.VISIBLE : AnimatedVisibility.HIDDEN} | ||
anchor={ref} | ||
placement='bottom right' | ||
> | ||
<Options | ||
onSelect={handleSelection} | ||
options={convertOptions(options, parser.text)} | ||
cursor={cursor} | ||
/> | ||
</PositionAnimated> | ||
</> | ||
); | ||
}; |
Oops, something went wrong.