File tree Expand file tree Collapse file tree 2 files changed +37
-9
lines changed
react/src/views/LinkPreview Expand file tree Collapse file tree 2 files changed +37
-9
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
22import PropTypes from 'prop-types' ;
3+ import { useTheme } from '@embeddedchat/ui-elements' ;
34import PlainSpan from './PlainSpan' ;
45import StrikeSpan from './StrikeSpan' ;
56import ItalicSpan from './ItalicSpan' ;
@@ -27,6 +28,9 @@ const getBaseURI = () => {
2728const isExternal = ( href ) => href . indexOf ( getBaseURI ( ) ) !== 0 ;
2829
2930const LinkSpan = ( { href, label } ) => {
31+ const { theme } = useTheme ( ) ;
32+ const { mode } = useTheme ( ) ;
33+
3034 const contents = React . useMemo ( ( ) => {
3135 const labelArray = Array . isArray ( label ) ? label : [ label ] ;
3236
@@ -54,13 +58,31 @@ const LinkSpan = ({ href, label }) => {
5458
5559 if ( isExternal ( href ) ) {
5660 return (
57- < a href = { href } title = { href } rel = "noopener noreferrer" target = "_blank" >
61+ < a
62+ href = { href }
63+ title = { href }
64+ style = { {
65+ color :
66+ mode === 'light'
67+ ? theme . colors . info
68+ : theme . colors . warningForeground ,
69+ } }
70+ rel = "noopener noreferrer"
71+ target = "_blank"
72+ >
5873 { contents }
5974 </ a >
6075 ) ;
6176 }
6277 return (
63- < a href = { href } title = { href } >
78+ < a
79+ href = { href }
80+ title = { href }
81+ style = { {
82+ color :
83+ mode === 'light' ? theme . colors . info : theme . colors . warningForeground ,
84+ } }
85+ >
6486 { contents }
6587 </ a >
6688 ) ;
Original file line number Diff line number Diff line change 11import React , { useState } from 'react' ;
22import PropTypes from 'prop-types' ;
3- import { css } from '@emotion/react' ;
43import {
54 Box ,
65 ActionButton ,
@@ -20,6 +19,7 @@ const LinkPreview = ({
2019} ) => {
2120 const { classNames, styleOverrides } = useComponentOverrides ( 'LinkPreview' ) ;
2221 const { theme } = useTheme ( ) ;
22+ const { mode } = useTheme ( ) ;
2323 const styles = getLinkPreviewStyles ( theme ) ;
2424
2525 const [ isPreviewOpen , setIsPreviewOpen ] = useState ( true ) ;
@@ -88,9 +88,12 @@ const LinkPreview = ({
8888 < Box style = { { padding : '8px' } } >
8989 < a
9090 href = { url }
91- css = { css `
92- color : ${ theme . colors . foreground } ;
93- ` }
91+ style = { {
92+ color :
93+ mode === 'light'
94+ ? theme . colors . info
95+ : theme . colors . warningForeground ,
96+ } }
9497 target = "_blank"
9598 rel = "noopener noreferrer"
9699 >
@@ -100,9 +103,12 @@ const LinkPreview = ({
100103 { isSiteName && (
101104 < a
102105 href = { url }
103- css = { css `
104- color : ${ theme . colors . foreground } ;
105- ` }
106+ style = { {
107+ color :
108+ mode === 'light'
109+ ? theme . colors . info
110+ : theme . colors . warningForeground ,
111+ } }
106112 target = "_blank"
107113 rel = "noopener noreferrer"
108114 >
You can’t perform that action at this time.
0 commit comments