-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
1,046 additions
and
59 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@lg-chat/message': minor | ||
--- | ||
|
||
Adds the links prop which renders link data as rich links after the message 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
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
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
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,23 @@ | ||
import { css } from '@leafygreen-ui/emotion'; | ||
import { Theme } from '@leafygreen-ui/lib'; | ||
import { palette } from '@leafygreen-ui/palette'; | ||
import { spacing } from '@leafygreen-ui/tokens'; | ||
|
||
export const baseStyles = css` | ||
container-type: inline-size; | ||
margin-bottom: ${spacing[200]}px; | ||
`; | ||
|
||
export const dividingLineStyles: Record<Theme, string> = { | ||
[Theme.Dark]: css` | ||
border: 1px solid ${palette.gray.dark2}; | ||
`, | ||
[Theme.Light]: css` | ||
border: 1px solid ${palette.gray.light2}; | ||
`, | ||
}; | ||
|
||
export const linksHeadingStyles = css` | ||
margin-bottom: 8px; | ||
line-height: 28px; | ||
`; |
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,29 @@ | ||
import React from 'react'; | ||
import { type MessageLinksProps } from './MessageLinks.types'; | ||
import { Subtitle } from '@leafygreen-ui/typography'; | ||
import { RichLinksArea } from '@lg-chat/rich-links'; | ||
import { cx } from '@leafygreen-ui/emotion'; | ||
import { | ||
baseStyles, | ||
dividingLineStyles, | ||
linksHeadingStyles, | ||
} from './MessageLinks.styles'; | ||
import { useDarkMode } from '@leafygreen-ui/leafygreen-provider'; | ||
|
||
export function MessageLinks({ | ||
darkMode: darkModeProp, | ||
headingText = 'Related Resources', | ||
links, | ||
...divProps | ||
}: MessageLinksProps) { | ||
const { theme } = useDarkMode(darkModeProp); | ||
return ( | ||
<div className={cx(baseStyles)} {...divProps}> | ||
<hr className={cx(dividingLineStyles[theme])} /> | ||
<Subtitle className={cx(linksHeadingStyles)}>{headingText}</Subtitle> | ||
<RichLinksArea links={links} /> | ||
</div> | ||
); | ||
} | ||
|
||
MessageLinks.displayName = 'MessageLinks'; |
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 { DarkModeProps, HTMLElementProps } from '@leafygreen-ui/lib'; | ||
import { type RichLinkProps } from '@lg-chat/rich-links'; | ||
|
||
export interface MessageLinksProps | ||
extends DarkModeProps, | ||
Omit<HTMLElementProps<'div'>, 'children'> { | ||
/** | ||
* The text to display as the heading of the links section. | ||
*/ | ||
headingText?: string; | ||
|
||
/** | ||
* An list of link data to render in the links section. | ||
*/ | ||
links: Array<RichLinkProps>; | ||
} |
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,2 @@ | ||
export { MessageLinks } from './MessageLinks'; | ||
export { type MessageLinksProps } from './MessageLinks.types'; |
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 |
---|---|---|
|
@@ -47,5 +47,8 @@ | |
{ | ||
"path": "../../packages/banner" | ||
}, | ||
{ | ||
"path": "../rich-links" | ||
}, | ||
] | ||
} |
Oops, something went wrong.