This repository has been archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
feat(Chat): add actionMenu
prop for ChatMessage
#811
Merged
Merged
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
e971393
wip
layershifter 9a8792b
Merge branch 'master' of https://github.com/stardust-ui/react into fe…
layershifter 99cf848
wip
layershifter 609691f
use lodash
layershifter 57b4578
pass onBlur
layershifter 38c163a
pick popoverBehavior
layershifter bfd46f9
fix propTypes
layershifter 56d1dcf
Merge branch 'master' of https://github.com/stardust-ui/react into fe…
layershifter 52d3f9a
add changelog entry
layershifter e33cfcc
Merge branches 'feat/chat-message-actions' and 'master' of https://gi…
layershifter bd3f99a
restore behavior
layershifter ad72918
fix emojis for screen readers
layershifter 784cc93
Merge branches 'feat/chat-message-actions' and 'master' of https://gi…
layershifter 920fb74
Merge branches 'feat/chat-message-actions' and 'master' of https://gi…
layershifter 91f64be
rename variables
layershifter c959bf9
remove modifier
layershifter 76391f0
remove useless var
layershifter df94e42
clean ups
layershifter 89ea89a
Update ChatMessage.tsx
layershifter f29d8fb
add comment
layershifter 5e3befb
Merge branches 'feat/chat-message-actions' and 'master' of https://gi…
layershifter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
63 changes: 63 additions & 0 deletions
63
docs/src/examples/components/Chat/Content/ChatExampleActions.shorthand.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,63 @@ | ||
import { Avatar, Chat } from '@stardust-ui/react' | ||
import * as React from 'react' | ||
|
||
const actionMenu = { | ||
iconOnly: true, | ||
items: [ | ||
{ key: 'like', icon: 'like', title: 'Like' }, | ||
{ key: 'more', icon: 'more', title: 'More actions' }, | ||
], | ||
} | ||
|
||
const items = [ | ||
{ | ||
attached: 'top', | ||
contentPosition: 'end', | ||
message: { | ||
content: ( | ||
<Chat.Message | ||
actionMenu={actionMenu} | ||
content="Hello" | ||
author="John Doe" | ||
timestamp="Yesterday, 10:15 PM" | ||
mine | ||
/> | ||
), | ||
}, | ||
key: 'message-1', | ||
}, | ||
{ | ||
attached: 'bottom', | ||
contentPosition: 'end', | ||
key: 'message-2', | ||
message: { | ||
content: ( | ||
<Chat.Message | ||
actionMenu={actionMenu} | ||
content="I'm back!" | ||
author="John Doe" | ||
timestamp="Yesterday, 10:15 PM" | ||
mine | ||
/> | ||
), | ||
}, | ||
}, | ||
{ | ||
gutter: { content: <Avatar image="public/images/avatar/small/ade.jpg" /> }, | ||
message: { | ||
content: ( | ||
<Chat.Message | ||
actionMenu={actionMenu} | ||
content="Hi" | ||
author="Jane Doe" | ||
timestamp="Yesterday, 10:15 PM" | ||
/> | ||
), | ||
}, | ||
key: 'message-3', | ||
}, | ||
] | ||
|
||
const ChatExample = () => <Chat items={items} /> | ||
|
||
export default ChatExample |
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,16 @@ | ||
import * as React from 'react' | ||
|
||
import ComponentExample from 'docs/src/components/ComponentDoc/ComponentExample' | ||
import ExampleSection from 'docs/src/components/ComponentDoc/ExampleSection' | ||
|
||
const Content = () => ( | ||
<ExampleSection title="Types"> | ||
<ComponentExample | ||
title="Actions" | ||
description="A chat message can contain actions." | ||
examplePath="components/Chat/Content/ChatExampleActions" | ||
/> | ||
</ExampleSection> | ||
) | ||
|
||
export default Content |
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 |
---|---|---|
@@ -1,10 +1,13 @@ | ||
import * as React from 'react' | ||
|
||
import Content from './Content' | ||
import Types from './Types' | ||
|
||
const ChatExamples = () => ( | ||
<div> | ||
<> | ||
<Types /> | ||
</div> | ||
<Content /> | ||
</> | ||
) | ||
|
||
export default ChatExamples |
57 changes: 0 additions & 57 deletions
57
docs/src/prototypes/chatMessageWithPopover/ChatMessageWithPopover.tsx
This file was deleted.
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just putting my vote on that: would rather prefer
actions
thanactionsMenu
for the following reasonsactionsPanel
Attachment
component, where there is anaction
slotThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but given the example from description, agree that it is definitely better to use singular
menu
noun in the name of the prop, to properly reflect underlying semanticsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, a bit surprised that we are not handling array as 'primitive' shorthand values - is there any particular reason for that? Might expect that this feature is necessary for all the places where collection-container component stays as a default one for shorthand value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can be wrong, but this decision came from the consistency point: you can pass only
ShorthandValue
orShorthandValue[]
. However, I understand your point, had the same feeling about it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, thank you @layershifter! actually, this original problem (
actions
and necessity to compromise onactionsMenu
) is a good example that might serve as an inspiration for us to further refine this moment in future