-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Changes 1. update path of files 2. vertical position of powered by banner / vertical position of scroll to bottom button ### Before <img width="361" alt="image" src="https://github.com/sendbird/chat-ai-widget/assets/26326015/cdddb597-d78a-467c-8780-86181bd6a811"> ### After <img width="377" alt="image" src="https://github.com/sendbird/chat-ai-widget/assets/26326015/1cacfc0b-57c2-4520-8677-3745bdef066b"> ticket: [AC-2602] [AC-2602]: https://sendbird.atlassian.net/browse/AC-2602?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
- Loading branch information
Showing
8 changed files
with
76 additions
and
132 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
File renamed without changes.
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,69 @@ | ||
import ReactDOM from 'react-dom'; | ||
import styled from 'styled-components'; | ||
|
||
import useSendbirdStateContext from '@uikit/hooks/useSendbirdStateContext'; | ||
|
||
import { useConstantState } from '../../context/ConstantContext'; | ||
import SendbirdLogo from '../../icons/sendbird-logo.svg'; | ||
import { hideChatBottomBanner } from '../../utils'; | ||
|
||
export function PoweredByBanner() { | ||
const store = useSendbirdStateContext(); | ||
const sdk = store.stores.sdkStore.sdk; | ||
|
||
if (hideChatBottomBanner(sdk)) { | ||
return null; | ||
} | ||
|
||
const inputElement = document.querySelector( | ||
'.sendbird-message-input-wrapper' | ||
); | ||
|
||
return inputElement ? ReactDOM.createPortal(<Banner />, inputElement) : null; | ||
} | ||
|
||
const InnerContainer = styled.div<{ chatBottomBackgroundColor?: string }>` | ||
padding-bottom: 12px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
background: ${({ theme, chatBottomBackgroundColor }) => | ||
chatBottomBackgroundColor || theme.bgColor.bottomBanner}; | ||
color: ${({ theme }) => theme.textColor.bottomBanner.poweredBy}; | ||
flex-wrap: wrap; | ||
font-size: 13px; | ||
svg { | ||
path { | ||
fill: ${({ theme }) => theme.textColor.bottomBanner.logo}; | ||
} | ||
} | ||
`; | ||
|
||
const Highlighter = styled.a` | ||
color: white; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
`; | ||
|
||
// link: https://dashboard.sendbird.com/auth/signup | ||
function Banner() { | ||
const { chatBottomContent } = useConstantState(); | ||
|
||
return ( | ||
<InnerContainer | ||
chatBottomBackgroundColor={chatBottomContent.backgroundColor} | ||
> | ||
{chatBottomContent?.text} Powered by | ||
<Highlighter | ||
aria-label="Learn more about Sendbird Chatbot" | ||
href="https://sendbird.com/products/ai-chatbot" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
<SendbirdLogo width={'75px'} /> | ||
</Highlighter> | ||
</InnerContainer> | ||
); | ||
} |