@@ -6767,8 +6767,11 @@ import AnimateHeight from "react-animate-height";
67676767// src/lib/table-of-contents/styles.ts
67686768var itemsContainer = {
67696769 position : "sticky" ,
6770- top : "calc(5rem + 32px)" ,
6771- borderLeft : "1px solid #E7E9EE"
6770+ top : "calc(5rem + 32px)"
6771+ } ;
6772+ var headings = {
6773+ borderLeft : "1px solid #E7E9EE" ,
6774+ mb : "16px"
67726775} ;
67736776var item = ( level , active ) => {
67746777 const defaultLineHeight = `${ level === 1 ? 18 : 22 } px` ;
@@ -6797,33 +6800,33 @@ var subItemsContainer = {
67976800 ml : "16px" ,
67986801 borderLeft : "1px solid #E7E9EE"
67996802} ;
6800- var styles_default6 = { itemsContainer, item, subItemsContainer } ;
6803+ var styles_default6 = { itemsContainer, item, subItemsContainer, headings } ;
68016804
68026805// src/lib/table-of-contents/TableOfContents.tsx
68036806import { jsx as jsx11 , jsxs as jsxs7 } from "react/jsx-runtime" ;
6804- var TableOfContents = ( { headingList } ) => {
6807+ var TableOfContents = ( { headingList, children } ) => {
68056808 const router = useRouter ( ) ;
68066809 const { headingItems, activeItem, setHeadingItems, setActiveItem } = useContext2 ( LibraryContext ) ;
68076810 useEffect5 ( ( ) => {
6808- const headings = headingList ?? [ ] ;
6809- if ( ! headings . length ) {
6811+ const headings2 = headingList ?? [ ] ;
6812+ if ( ! headings2 . length ) {
68106813 document . querySelectorAll ( "h2, h3" ) . forEach ( ( heading ) => {
68116814 const headingSlug = heading . id ;
68126815 const item2 = {
68136816 title : removeHTML ( heading . innerHTML ) . replace ( ":" , "" ) ,
68146817 slug : headingSlug
68156818 } ;
68166819 if ( heading . tagName === "H2" ) {
6817- headings . push ( { ...item2 , children : [ ] } ) ;
6818- } else if ( headings . length > 0 ) {
6819- headings [ headings . length - 1 ] . children . push ( { ...item2 } ) ;
6820+ headings2 . push ( { ...item2 , children : [ ] } ) ;
6821+ } else if ( headings2 . length > 0 ) {
6822+ headings2 [ headings2 . length - 1 ] . children . push ( { ...item2 } ) ;
68206823 } else {
6821- headings . push ( { ...item2 , children : [ ] } ) ;
6824+ headings2 . push ( { ...item2 , children : [ ] } ) ;
68226825 }
68236826 } ) ;
6824- setHeadingItems ( headings ) ;
6827+ setHeadingItems ( headings2 ) ;
68256828 } else
6826- setHeadingItems ( headings ) ;
6829+ setHeadingItems ( headings2 ) ;
68276830 } , [ router . asPath , headingList ] ) ;
68286831 const Item = ( {
68296832 title : title6 ,
@@ -6845,34 +6848,37 @@ var TableOfContents = ({ headingList }) => {
68456848 }
68466849 ) ;
68476850 } ;
6848- return /* @__PURE__ */ jsx11 ( Box7 , { sx : styles_default6 . itemsContainer , "data-cy" : "table-of-contents" , children : headingItems . map ( ( item2 ) => /* @__PURE__ */ jsxs7 ( Box7 , { children : [
6849- /* @__PURE__ */ jsx11 (
6850- Item ,
6851- {
6852- title : item2 . title ,
6853- slug : item2 . slug ,
6854- level : 1 ,
6855- active : item2 . slug === activeItem . item
6856- }
6857- ) ,
6858- /* @__PURE__ */ jsx11 (
6859- AnimateHeight ,
6860- {
6861- duration : 300 ,
6862- height : item2 . slug === activeItem . item ? "auto" : 0 ,
6863- children : /* @__PURE__ */ jsx11 ( Box7 , { sx : styles_default6 . subItemsContainer , children : item2 . children . map ( ( subItem ) => /* @__PURE__ */ jsx11 (
6864- Item ,
6865- {
6866- title : subItem . title ,
6867- slug : subItem . slug ,
6868- level : 2 ,
6869- active : subItem . slug === activeItem . subItem
6870- } ,
6871- subItem . slug
6872- ) ) } )
6873- }
6874- )
6875- ] } , item2 . slug ) ) } ) ;
6851+ return /* @__PURE__ */ jsxs7 ( Box7 , { sx : styles_default6 . itemsContainer , "data-cy" : "table-of-contents" , children : [
6852+ /* @__PURE__ */ jsx11 ( Box7 , { sx : styles_default6 . headings , children : headingItems . map ( ( item2 ) => /* @__PURE__ */ jsxs7 ( Box7 , { children : [
6853+ /* @__PURE__ */ jsx11 (
6854+ Item ,
6855+ {
6856+ title : item2 . title ,
6857+ slug : item2 . slug ,
6858+ level : 1 ,
6859+ active : item2 . slug === activeItem . item
6860+ }
6861+ ) ,
6862+ /* @__PURE__ */ jsx11 (
6863+ AnimateHeight ,
6864+ {
6865+ duration : 300 ,
6866+ height : item2 . slug === activeItem . item ? "auto" : 0 ,
6867+ children : /* @__PURE__ */ jsx11 ( Box7 , { sx : styles_default6 . subItemsContainer , children : item2 . children . map ( ( subItem ) => /* @__PURE__ */ jsx11 (
6868+ Item ,
6869+ {
6870+ title : subItem . title ,
6871+ slug : subItem . slug ,
6872+ level : 2 ,
6873+ active : subItem . slug === activeItem . subItem
6874+ } ,
6875+ subItem . slug
6876+ ) ) } )
6877+ }
6878+ )
6879+ ] } , item2 . slug ) ) } ) ,
6880+ children
6881+ ] } ) ;
68766882} ;
68776883var TableOfContents_default = TableOfContents ;
68786884
@@ -9612,28 +9618,37 @@ var like_selected_icon_default = LikeSelectedIcon;
96129618import { useContext as useContext12 , useRef as useRef10 , useState as useState12 } from "react" ;
96139619
96149620// src/lib/feedback-section/styles.ts
9615- var container5 = {
9621+ var container5 = ( { small } = { } ) => ( {
96169622 width : "100%" ,
96179623 paddingBottom : "16px" ,
9618- borderBottom : [ "none" , "1px solid #E7E9EE" ] ,
9619- flexDirection : [ "column" , "row" ] ,
9620- alignItems : "center" ,
9624+ borderBottom : small ? "none" : [ "none" , "1px solid #E7E9EE" ] ,
9625+ flexDirection : small ? "column" : [ "column" , "row" ] ,
9626+ alignItems : small ? "flex-start" : "center" ,
96219627 alignContent : [ "initial" , "space-between" ] ,
96229628 justifyContent : [ "initial" , "space-between" ] ,
9623- marginTop : "32px" ,
9624- marginBottom : "16px"
9625- } ;
9626- var question = {
9627- fontSize : "16px" ,
9628- lineHeight : "18px"
9629- } ;
9629+ marginTop : small ? "0px" : "32px" ,
9630+ marginBottom : "16px" ,
9631+ gap : small ? "8px" : "0px"
9632+ } ) ;
9633+ var question = ( { small } = { } ) => ( {
9634+ fontSize : small ? "12px" : "16px" ,
9635+ lineHeight : "18px" ,
9636+ color : "#4A596B"
9637+ } ) ;
9638+ var iconsContainer = ( { small } = { } ) => ( {
9639+ display : "flex" ,
9640+ alignItems : "center" ,
9641+ gap : small ? "2px" : "4px" ,
9642+ ml : small ? "3px" : "6px"
9643+ } ) ;
96309644var likeContainer = {
96319645 paddingBottom : [ "16px" , "0" ] ,
96329646 borderBottom : [ "1px solid #E7E9EE" , "none" ] ,
96339647 mt : [ "8px" , "0" ] ,
96349648 mb : [ "16px" , "0" ] ,
96359649 width : [ "100%" , "auto" ] ,
9636- justifyContent : [ "center" , "initial" ]
9650+ justifyContent : [ "center" , "initial" ] ,
9651+ alignItems : "center"
96379652} ;
96389653var likeIcon = {
96399654 mr : "2px"
@@ -9661,22 +9676,22 @@ var buttonActive = {
96619676var selectedButton = {
96629677 color : "muted.1"
96639678} ;
9664- var box = {
9679+ var box = ( { small } = { } ) => ( {
96659680 alignItems : "center" ,
96669681 color : "muted.0" ,
9667- fontSize : "16px" ,
9682+ fontSize : small ? "12px" : "16px" ,
96689683 lineHeight : "22px"
9669- } ;
9670- var editContainer = {
9671- ...box ,
9684+ } ) ;
9685+ var editContainer = ( { small } = { } ) => ( {
9686+ ...box ( { small } ) ,
96729687 ...button ,
96739688 ":hover" : {
96749689 color : "#000711 !important"
96759690 } ,
96769691 // ml: ['0', 'auto'],
96779692 color : "#4A596B !important" ,
96789693 display : "flex"
9679- } ;
9694+ } ) ;
96809695var editIcon = { mr : "4px" } ;
96819696var shareButton = {
96829697 // ml: ['0', 'auto'],
@@ -9693,17 +9708,17 @@ var styles_default16 = {
96939708 button,
96949709 buttonActive,
96959710 selectedButton,
9696- shareButton
9711+ shareButton,
9712+ iconsContainer
96979713} ;
96989714
96999715// src/lib/feedback-section/functions.ts
97009716var setButtonStyle = ( feedback , modalState , like ) => {
97019717 const buttonactive = modalState . modalOpen && like === modalState . liked ? styles_default16 . buttonActive : styles_default16 . button ;
9702- const ml = like ? [ "0" , "8px" ] : feedback === like ? [ "0" , "8px" ] : [ "32px" , "16px" ] ;
97039718 if ( feedback === void 0 )
9704- return { ...styles_default16 . box , ...buttonactive , ml } ;
9719+ return { ...styles_default16 . box , ...buttonactive } ;
97059720 if ( like === feedback )
9706- return { ...styles_default16 . box , ...styles_default16 . selectedButton , ml } ;
9721+ return { ...styles_default16 . box , ...styles_default16 . selectedButton } ;
97079722 return { display : "none !important" } ;
97089723} ;
97099724
@@ -10224,7 +10239,8 @@ var FeedbackSection = ({
1022410239 urlToEdit,
1022510240 suggestEdits = true ,
1022610241 shareButton : shareButton2 = false ,
10227- sendFeedback
10242+ sendFeedback,
10243+ small = false
1022810244} ) => {
1022910245 const [ feedback , changeFeedback ] = useState12 ( void 0 ) ;
1023010246 const [ prevSlug , setPrevSlug ] = useState12 ( slug ) ;
@@ -10245,44 +10261,52 @@ var FeedbackSection = ({
1024510261 liked : choice
1024610262 } ) ;
1024710263 } ;
10248- return /* @__PURE__ */ jsxs41 ( Flex16 , { sx : styles_default16 . container , "data-cy" : "feedback-section" , children : [
10264+ return /* @__PURE__ */ jsxs41 ( Flex16 , { sx : styles_default16 . container ( { small } ) , "data-cy" : "feedback-section" , children : [
1024910265 /* @__PURE__ */ jsxs41 ( Flex16 , { sx : styles_default16 . likeContainer , children : [
10250- /* @__PURE__ */ jsx52 ( Text12 , { sx : styles_default16 . question , children : feedback !== void 0 ? messages [ locale ] [ "feedback_section.response" ] : messages [ locale ] [ "feedback_section.question" ] } ) ,
10251- /* @__PURE__ */ jsxs41 (
10252- Flex16 ,
10253- {
10254- ref : likeButton ,
10255- sx : setButtonStyle ( feedback , modalState , true ) ,
10256- onClick : feedback === void 0 ? ( ) => openModal ( true ) : null ,
10257- "data-cy" : "feedback-section-like" ,
10258- children : [
10259- feedback === void 0 || ! feedback ? /* @__PURE__ */ jsx52 ( like_icon_default , { size : 24 , sx : styles_default16 . likeIcon } ) : /* @__PURE__ */ jsx52 ( like_selected_icon_default , { size : 24 , sx : styles_default16 . likeIcon } ) ,
10260- /* @__PURE__ */ jsx52 ( Text12 , { children : messages [ locale ] [ "feedback_section.positive" ] } )
10261- ]
10262- }
10263- ) ,
10264- /* @__PURE__ */ jsxs41 (
10265- Flex16 ,
10266- {
10267- ref : dislikeButton ,
10268- sx : setButtonStyle ( feedback , modalState , false ) ,
10269- onClick : feedback === void 0 ? ( ) => openModal ( false ) : null ,
10270- children : [
10271- feedback === void 0 || feedback ? /* @__PURE__ */ jsx52 ( like_icon_default , { size : 24 , sx : styles_default16 . dislikeIcon } ) : /* @__PURE__ */ jsx52 ( like_selected_icon_default , { size : 24 , sx : styles_default16 . dislikeIcon } ) ,
10272- /* @__PURE__ */ jsx52 ( Text12 , { children : messages [ locale ] [ "feedback_section.negative" ] } )
10273- ]
10274- }
10275- )
10266+ /* @__PURE__ */ jsx52 ( Text12 , { sx : styles_default16 . question ( { small } ) , children : feedback !== void 0 ? messages [ locale ] [ "feedback_section.response" ] : messages [ locale ] [ "feedback_section.question" ] } ) ,
10267+ /* @__PURE__ */ jsxs41 ( Flex16 , { sx : styles_default16 . iconsContainer , children : [
10268+ /* @__PURE__ */ jsxs41 (
10269+ Flex16 ,
10270+ {
10271+ ref : likeButton ,
10272+ sx : setButtonStyle ( feedback , modalState , true ) ,
10273+ onClick : feedback === void 0 ? ( ) => openModal ( true ) : null ,
10274+ "data-cy" : "feedback-section-like" ,
10275+ children : [
10276+ feedback === void 0 || ! feedback ? /* @__PURE__ */ jsx52 ( like_icon_default , { size : small ? 18 : 24 , sx : styles_default16 . likeIcon } ) : /* @__PURE__ */ jsx52 ( like_selected_icon_default , { size : small ? 18 : 24 , sx : styles_default16 . likeIcon } ) ,
10277+ ! small && /* @__PURE__ */ jsx52 ( Text12 , { children : messages [ locale ] [ "feedback_section.positive" ] } )
10278+ ]
10279+ }
10280+ ) ,
10281+ /* @__PURE__ */ jsxs41 (
10282+ Flex16 ,
10283+ {
10284+ ref : dislikeButton ,
10285+ sx : setButtonStyle ( feedback , modalState , false ) ,
10286+ onClick : feedback === void 0 ? ( ) => openModal ( false ) : null ,
10287+ children : [
10288+ feedback === void 0 || feedback ? /* @__PURE__ */ jsx52 ( like_icon_default , { size : small ? 18 : 24 , sx : styles_default16 . dislikeIcon } ) : /* @__PURE__ */ jsx52 (
10289+ like_selected_icon_default ,
10290+ {
10291+ size : small ? 18 : 24 ,
10292+ sx : styles_default16 . dislikeIcon
10293+ }
10294+ ) ,
10295+ ! small && /* @__PURE__ */ jsx52 ( Text12 , { children : messages [ locale ] [ "feedback_section.negative" ] } )
10296+ ]
10297+ }
10298+ )
10299+ ] } )
1027610300 ] } ) ,
1027710301 suggestEdits && /* @__PURE__ */ jsxs41 (
1027810302 Link8 ,
1027910303 {
1028010304 target : "_blank" ,
1028110305 rel : "noopener noreferrer" ,
1028210306 href : urlToEdit ,
10283- sx : styles_default16 . editContainer ,
10307+ sx : styles_default16 . editContainer ( { small } ) ,
1028410308 children : [
10285- /* @__PURE__ */ jsx52 ( edit_icon_default , { size : 24 , sx : styles_default16 . editIcon } ) ,
10309+ /* @__PURE__ */ jsx52 ( edit_icon_default , { size : small ? 18 : 24 , sx : styles_default16 . editIcon } ) ,
1028610310 /* @__PURE__ */ jsx52 ( Text12 , { children : messages [ locale ] [ "feedback_section.edit" ] } )
1028710311 ]
1028810312 }
0 commit comments