visortelle commented on code in PR #789:
URL: https://github.com/apache/pulsar-site/pull/789#discussion_r1489285058
##########
src/components/pages/UseCasesPage/UseCasesPage.tsx:
##########
@@ -0,0 +1,57 @@
+import React from 'react';
+import s from './UseCasesPage.module.css';
+import Layout from '@theme/Layout';
+import cases from '@site/data/usecases';
+import Case, { CaseProps } from './Case/Case';
+
+const UseCasesPage: React.FC = () => {
+ return (
+ <Layout
+ title='Pulsar Use Cases'
+ description='A combination of unique and common use cases sets Pulsar
apart from other message brokers.'
+ >
+ <div className={s.UseCasesPageHeader}>
+ <div>
+ <h1>Pulsar Use Cases</h1>
+ <h2>A combination of unique and common use cases sets Pulsar apart
from other message brokers.</h2>
+ </div>
+ </div>
+ <div className={s.UseCasesPage}>
+ <div className={s.UseCasesPageSidebar}>
+ <div>
+ {cases.map((scase, i) => (
+ <a href={`#case${i}`} key={i}
className={s.UseCasesPageCaseLink}>{scase.title}</a>
+ ))}
+ </div>
+ </div>
+ <div className={s.UseCasesPageContent}>
+ {cases.map((scase, i) => (
+ <div id={`case${i}`} key={i} className={s.UseCasesPageCase}>
+ <Case {...scase} />
+ </div>
+ ))}
+ </div>
+ </div>
+ </Layout>
+ );
+}
+
+export default UseCasesPage;
+
+const updateSidebarLinks = () => {
+ let currentCase = 0;
+ let allcases = document.querySelectorAll('.'+s.UseCasesPageCase);
+ let allcaselinks = document.querySelectorAll('.'+s.UseCasesPageCaseLink);
+ if(allcases.length > 0 && allcaselinks.length > 0 && allcaselinks.length ==
allcases.length){
+ allcases.forEach((e,i) => {
+ let postop = e.getBoundingClientRect().top
+ if(postop < 96) currentCase = i;
+ });
+ allcaselinks.forEach((e,i) => {
+ if(currentCase == i) e.classList.add(s.active);
+ else e.classList.remove(s.active)
+ });
+ }
+}
+window.addEventListener('load', updateSidebarLinks);
Review Comment:
The build fails here with this error:
<img width="743" alt="Screenshot 2024-02-14 at 2 48 15 PM"
src="https://github.com/apache/pulsar-site/assets/9302460/f13438bd-7124-42f8-b6d9-fe966df73324">
Quick-fix:
https://github.com/visortelle/pulsar-site-2024-updates/commit/9ec01618e994ee95a2b137c4c8a5d18cba3a80a8
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]