File tree Expand file tree Collapse file tree 2 files changed +36
-11
lines changed
frontend/src/components/shared/StreamlitMarkdown Expand file tree Collapse file tree 2 files changed +36
-11
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ import {
3939 StyledStreamlitMarkdown ,
4040 StyledLinkIconContainer ,
4141 StyledLinkIcon ,
42+ StyledHeaderContent ,
4243} from "./styled-components"
4344
4445import "katex/dist/katex.min.css"
@@ -147,10 +148,10 @@ function HeadingWithAnchor({
147148 < StyledLinkIconContainer >
148149 { elementId && (
149150 < StyledLinkIcon href = { `#${ elementId } ` } >
150- < LinkIcon size = "20" color = "#ccc " />
151+ < LinkIcon size = "18 " />
151152 </ StyledLinkIcon >
152153 ) }
153- { children }
154+ < StyledHeaderContent > { children } </ StyledHeaderContent >
154155 </ StyledLinkIconContainer >
155156 )
156157}
Original file line number Diff line number Diff line change @@ -41,22 +41,46 @@ export const StyledStreamlitMarkdown = styled.div(({ theme }) => ({
4141 } ,
4242} ) )
4343
44- export const StyledLinkIconContainer = styled . div ( ( { theme } ) => ( {
44+ export const StyledLinkIconContainer = styled . div ( ( ) => ( {
4545 position : "relative" ,
46- left : "-30px" ,
47- paddingLeft : "30px" ,
48- a : {
49- display : "none" ,
50- } ,
46+ left : "calc(-2.5rem - 0.5rem)" ,
47+ width : "calc(100% + 2.5rem + 0.5rem)" ,
48+ display : "flex" ,
49+ alignItems : "flex-start" ,
5150 ":hover" : {
5251 a : {
53- display : "inline-block" ,
52+ opacity : 0.75 ,
5453 } ,
5554 } ,
5655} ) )
5756
5857export const StyledLinkIcon = styled . a ( ( { theme } ) => ( {
59- position : "absolute " ,
60- top : "-2px " ,
58+ position : "relative " ,
59+ top : "calc(-1.25rem + 0.5em) " ,
6160 left : 0 ,
61+ marginRight : "0.5rem" ,
62+
63+ // center icon
64+ lineHeight : 0 ,
65+ display : "inline-flex" ,
66+ alignItems : "center" ,
67+ justifyContent : "center" ,
68+
69+ // copied from full screen button
70+ transition : "opacity 300ms" ,
71+ opacity : 0 ,
72+ height : "2.5rem" ,
73+ width : "2.5rem" ,
74+ zIndex : theme . zIndices . sidebar + 1 ,
75+ border : "none" ,
76+ backgroundColor : theme . colors . white ,
77+ borderRadius : theme . radii . xl ,
78+
79+ svg : {
80+ stroke : theme . colors . bodyText ,
81+ } ,
82+ } ) )
83+
84+ export const StyledHeaderContent = styled . span ( ( ) => ( {
85+ position : "relative" ,
6286} ) )
You can’t perform that action at this time.
0 commit comments