Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

feat(ChatMessage): add hasMention and isImportant variables in Teams theme #841

Merged
merged 9 commits into from
Feb 5, 2019

Conversation

mnajdova
Copy link
Contributor

@mnajdova mnajdova commented Feb 5, 2019

This PR adds hasMention, isImportant, hasMentionColor and isImportantColor variables in the ChatMessage for Teams theme. These variables are controlling the color of the badge, as well as are adding the left border on the messages.

Prototype:

image

API (Teams theme):

image

Code:

import React from 'react'
import { Avatar, Chat, Divider } from '@stardust-ui/react'
const janeAvatar = {
  image: 'public/images/avatar/small/ade.jpg',
  status: {
    color: 'green',
    icon: 'check',
  },
}
const items = [
  {
    message: {
      content: (
        <Chat.Message
          content="Hello"
          author="John Doe"
          timestamp="Yesterday, 10:15 PM"
          mine
          badge={{
            icon: 'mention',
          }}
          variables={{
            hasMention: true,
          }}
        />
      ),
    },
    contentPosition: 'end',
    attached: 'top',
    key: 'message-id-1',
  },
  {
    message: {
      content: (
        <Chat.Message
          content="I'm back!"
          author="John Doe"
          timestamp="Yesterday, 10:15 PM"
          mine
          badge={{
            icon: 'redbang',
          }}
          variables={{
            isImportant: true,
          }}
        />
      ),
    },
    contentPosition: 'end',
    attached: true,
    key: 'message-id-2',
  },
  {
    message: {
      content: (
        <Chat.Message
          content="Thanks for waiting!"
          author="John Doe"
          timestamp="Yesterday, 10:15 PM"
          mine
          badge={{
            icon: 'mention',
          }}
          variables={{
            hasMention: true,
          }}
        />
      ),
    },
    contentPosition: 'end',
    attached: 'bottom',
    key: 'message-id-3',
  },
  {
    gutter: {
      content: <Avatar {...janeAvatar} />,
    },
    message: {
      content: (
        <Chat.Message
          content="Hi"
          author="Jane Doe"
          timestamp="Yesterday, 10:15 PM"
          badge={{
            icon: 'redbang',
          }}
          variables={{
            isImportant: true,
          }}
        />
      ),
    },
    attached: 'top',
    key: 'message-id-4',
  },
  {
    gutter: {
      content: <Avatar {...janeAvatar} />,
    },
    message: {
      content: (
        <Chat.Message
          content="No problem!"
          author="Jane Doe"
          timestamp="Yesterday, 10:15 PM"
          badge={{
            icon: 'mention',
          }}
          variables={{
            hasMention: true,
          }}
        />
      ),
    },
    attached: true,
    key: 'message-id-5',
  },
  {
    gutter: {
      content: <Avatar {...janeAvatar} />,
    },
    message: {
      content: (
        <Chat.Message
          content="What's up?"
          author="Jane Doe"
          timestamp="Yesterday, 10:15 PM"
          badge={{
            icon: 'mention',
          }}
          variables={{
            hasMention: true,
          }}
        />
      ),
    },
    attached: 'bottom',
    key: 'message-id-6',
  },
]

const ChatExample = () => <Chat items={items} />

export default ChatExample

@mnajdova mnajdova changed the title feat(Teams theme): add hasMention and isImportant variables feat(ChatMessage): add hasMention and isImportant variables in Teams theme Feb 5, 2019
props: p,
variables: v,
theme: {
siteVariables: { orange04, red },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this to chatMessageVariables?

Copy link
Contributor Author

@mnajdova mnajdova Feb 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, will add hasMentionColor and isImportantColor variables there.

@codecov
Copy link

codecov bot commented Feb 5, 2019

Codecov Report

Merging #841 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #841   +/-   ##
=======================================
  Coverage   93.54%   93.54%           
=======================================
  Files          21       21           
  Lines         728      728           
  Branches       69       69           
=======================================
  Hits          681      681           
  Misses         47       47

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c086719...b149a7e. Read the comment docs.

@@ -17,7 +17,6 @@ const items = [
mine
badge={{
icon: 'exclamation',
color: 'red',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@mnajdova mnajdova merged commit f854f12 into master Feb 5, 2019
@layershifter layershifter deleted the feat/mention-important-msgs-teams-theme branch February 19, 2019 09:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants