Add badges to avatars in group dialogs

This commit is contained in:
Evan Hahn 2021-11-20 09:41:21 -06:00 committed by GitHub
parent 7bb37dc63b
commit e490d91cc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 121 additions and 39 deletions

View file

@ -457,8 +457,10 @@ const renderTypingBubble = () => (
/>
);
const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
const useProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
getPreferredBadge: () => undefined,
i18n,
theme: React.useContext(StorybookThemeContext),
haveNewest: boolean('haveNewest', overrideProps.haveNewest !== false),
haveOldest: boolean('haveOldest', overrideProps.haveOldest !== false),
@ -494,13 +496,13 @@ const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
});
story.add('Oldest and Newest', () => {
const props = createProps();
const props = useProps();
return <Timeline {...props} />;
});
story.add('With active message request', () => {
const props = createProps({
const props = useProps({
isIncomingMessageRequest: true,
});
@ -508,7 +510,7 @@ story.add('With active message request', () => {
});
story.add('Without Newest Message', () => {
const props = createProps({
const props = useProps({
haveNewest: false,
});
@ -516,7 +518,7 @@ story.add('Without Newest Message', () => {
});
story.add('Without newest message, active message request', () => {
const props = createProps({
const props = useProps({
haveOldest: false,
isIncomingMessageRequest: true,
});
@ -525,7 +527,7 @@ story.add('Without newest message, active message request', () => {
});
story.add('Without Oldest Message', () => {
const props = createProps({
const props = useProps({
haveOldest: false,
scrollToIndex: -1,
});
@ -534,7 +536,7 @@ story.add('Without Oldest Message', () => {
});
story.add('Empty (just hero)', () => {
const props = createProps({
const props = useProps({
items: [],
});
@ -542,7 +544,7 @@ story.add('Empty (just hero)', () => {
});
story.add('Last Seen', () => {
const props = createProps({
const props = useProps({
oldestUnreadIndex: 13,
totalUnread: 2,
});
@ -551,7 +553,7 @@ story.add('Last Seen', () => {
});
story.add('Target Index to Top', () => {
const props = createProps({
const props = useProps({
scrollToIndex: 0,
});
@ -559,7 +561,7 @@ story.add('Target Index to Top', () => {
});
story.add('Typing Indicator', () => {
const props = createProps({
const props = useProps({
typingContactId: UUID.generate().toString(),
});
@ -567,7 +569,7 @@ story.add('Typing Indicator', () => {
});
story.add('With invited contacts for a newly-created group', () => {
const props = createProps({
const props = useProps({
invitedContactsForNewlyCreatedGroup: [
getDefaultConversation({
id: 'abc123',
@ -584,7 +586,7 @@ story.add('With invited contacts for a newly-created group', () => {
});
story.add('With "same name in direct conversation" warning', () => {
const props = createProps({
const props = useProps({
warning: {
type: ContactSpoofingType.DirectConversationWithSameTitle,
safeConversation: getDefaultConversation(),
@ -596,7 +598,7 @@ story.add('With "same name in direct conversation" warning', () => {
});
story.add('With "same name in group conversation" warning', () => {
const props = createProps({
const props = useProps({
warning: {
type: ContactSpoofingType.MultipleGroupMembersWithSameTitle,
acknowledgedGroupNameCollisions: {},