@rspress-theme-anatole/theme-default 0.7.24 → 0.7.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.css CHANGED
@@ -3757,6 +3757,15 @@ p {
3757
3757
  display: flex;
3758
3758
  }
3759
3759
 
3760
+ .faqs-item-question.faqs-item-link {
3761
+ text-decoration: none;
3762
+ cursor: pointer;
3763
+ }
3764
+
3765
+ .faqs-item-question.faqs-item-link:hover {
3766
+ color: #e63946;
3767
+ }
3768
+
3760
3769
  .faqs-item-answer {
3761
3770
  font-weight: 400;
3762
3771
  font-size: 16px;
@@ -4043,4 +4052,107 @@ p {
4043
4052
  margin: 2px 0 16px 0;
4044
4053
  color: #737373;
4045
4054
  font-size: 14px;
4055
+ }
4056
+
4057
+ /* Popular Topics Section */
4058
+ .popular-topics-section {
4059
+ width: 100%;
4060
+ margin: 0 auto;
4061
+ padding: 0 40px 48px;
4062
+ }
4063
+
4064
+ .popular-topics-title {
4065
+ font-size: 24px;
4066
+ font-weight: 700;
4067
+ line-height: 32px;
4068
+ color: #333;
4069
+ margin-bottom: 24px;
4070
+ }
4071
+
4072
+ .popular-topics-grid {
4073
+ display: grid;
4074
+ grid-template-columns: repeat(3, 1fr);
4075
+ gap: 16px;
4076
+ }
4077
+
4078
+ .popular-topics-card {
4079
+ display: flex;
4080
+ flex-direction: column;
4081
+ padding: 24px;
4082
+ border: 1px solid #e5e5e5;
4083
+ border-radius: 8px;
4084
+ background: #fff;
4085
+ text-decoration: none;
4086
+ transition: box-shadow 0.2s ease, border-color 0.2s ease;
4087
+ }
4088
+
4089
+ .popular-topics-card:hover {
4090
+ border-color: #d5d5d5;
4091
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
4092
+ }
4093
+
4094
+ .popular-topics-card-title {
4095
+ font-size: 20px;
4096
+ font-weight: 700;
4097
+ line-height: 28px;
4098
+ color: #333;
4099
+ margin: 0 0 8px 0;
4100
+ }
4101
+
4102
+ .popular-topics-card-desc {
4103
+ font-size: 16px;
4104
+ font-weight: 400;
4105
+ line-height: 22px;
4106
+ color: #666;
4107
+ margin: 0;
4108
+ line-height: 1.5;
4109
+ }
4110
+
4111
+ .popular-topics-show-more {
4112
+ display: flex;
4113
+ justify-content: center;
4114
+ margin-top: 24px;
4115
+ }
4116
+
4117
+ .popular-topics-show-more-link {
4118
+ display: flex;
4119
+ align-items: center;
4120
+ gap: 4px;
4121
+ font-size: 20px;
4122
+ font-weight: 700;
4123
+ line-height: 28px;
4124
+ color: #666;
4125
+ text-decoration: none;
4126
+ cursor: pointer;
4127
+ transition: color 0.2s ease;
4128
+ }
4129
+
4130
+ .popular-topics-show-more-link:hover {
4131
+ color: #333;
4132
+ }
4133
+
4134
+ .popular-topics-chevron {
4135
+ font-size: 12px;
4136
+ display: inline-block;
4137
+ transition: transform 0.3s ease;
4138
+ }
4139
+
4140
+ .popular-topics-chevron.expanded {
4141
+ transform: rotate(180deg);
4142
+ }
4143
+
4144
+ @media (max-width: 900px) {
4145
+ .popular-topics-grid {
4146
+ grid-template-columns: repeat(2, 1fr);
4147
+ }
4148
+ }
4149
+
4150
+ @media (max-width: 600px) {
4151
+ .popular-topics-section {
4152
+ padding: 0 20px 32px;
4153
+ }
4154
+
4155
+ .popular-topics-grid {
4156
+ grid-template-columns: 1fr;
4157
+ }
4046
4158
  }
package/dist/bundle.js CHANGED
@@ -1732,6 +1732,10 @@ function HomepageLayout(props) {
1732
1732
  frontmatter: frontmatter,
1733
1733
  routePath: routePath
1734
1734
  }),
1735
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(PopularTopicsSection, {
1736
+ frontmatter: frontmatter,
1737
+ routePath: routePath
1738
+ }),
1735
1739
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(HomepageFeaturesTabs, {
1736
1740
  frontmatter: frontmatter,
1737
1741
  routePath: routePath
@@ -1775,6 +1779,10 @@ function GettingStartLayout(props) {
1775
1779
  frontmatter: frontmatter,
1776
1780
  routePath: routePath
1777
1781
  }),
1782
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(PopularTopicsSection, {
1783
+ frontmatter: frontmatter,
1784
+ routePath: routePath
1785
+ }),
1778
1786
  (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)(NeedHelpSection, {
1779
1787
  frontmatter: frontmatter,
1780
1788
  routePath: routePath
@@ -3278,6 +3286,70 @@ function HomepageFeatures({ frontmatter, routePath }) {
3278
3286
  });
3279
3287
  }
3280
3288
 
3289
+ function PopularTopicsSection({ frontmatter, routePath }) {
3290
+ const [isExpanded, setIsExpanded] = __WEBPACK_EXTERNAL_MODULE_react__.useState(false);
3291
+ const popularTopics = frontmatter?.popularTopics;
3292
+ const DEFAULT_VISIBLE_COUNT = 3;
3293
+
3294
+ if (!popularTopics || !popularTopics.items || popularTopics.items.length === 0) {
3295
+ return null;
3296
+ }
3297
+
3298
+ const allItems = popularTopics.items;
3299
+ const hasMoreItems = allItems.length > DEFAULT_VISIBLE_COUNT;
3300
+ const visibleItems = isExpanded ? allItems : allItems.slice(0, DEFAULT_VISIBLE_COUNT);
3301
+
3302
+ const handleToggle = (e) => {
3303
+ e.preventDefault();
3304
+ setIsExpanded(!isExpanded);
3305
+ };
3306
+
3307
+ return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3308
+ className: "popular-topics-section",
3309
+ children: [
3310
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("h2", {
3311
+ className: "popular-topics-title",
3312
+ children: popularTopics.title ?? "Browse by popular topics"
3313
+ }),
3314
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3315
+ className: "popular-topics-grid",
3316
+ children: visibleItems.map((item, index) =>
3317
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("a", {
3318
+ href: item.link || "#",
3319
+ className: "popular-topics-card",
3320
+ children: [
3321
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("h3", {
3322
+ className: "popular-topics-card-title",
3323
+ children: item.title
3324
+ }),
3325
+ item.desc && (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
3326
+ className: "popular-topics-card-desc",
3327
+ children: item.desc
3328
+ })
3329
+ ]
3330
+ }, item.title || index)
3331
+ )
3332
+ }),
3333
+ hasMoreItems && (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3334
+ className: "popular-topics-show-more",
3335
+ children: (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("a", {
3336
+ href: "#",
3337
+ onClick: handleToggle,
3338
+ className: "popular-topics-show-more-link",
3339
+ children: [
3340
+ isExpanded
3341
+ ? (popularTopics.showLessText ?? "Show less topics")
3342
+ : (popularTopics.showMoreText ?? "Show more topics"),
3343
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("i", {
3344
+ className: isExpanded ? "fa-solid fa-chevron-up popular-topics-chevron" : "fa-solid fa-chevron-down popular-topics-chevron"
3345
+ })
3346
+ ]
3347
+ })
3348
+ })
3349
+ ]
3350
+ });
3351
+ }
3352
+
3281
3353
  function HomepageFeaturesTabs({ frontmatter, routePath }) {
3282
3354
  const [activeTab, setActiveTab] = __WEBPACK_EXTERNAL_MODULE_react__.useState(0);
3283
3355
  const featureTab = frontmatter?.featureTabs;
@@ -3358,6 +3430,70 @@ function HomepageFaqs({ frontmatter, routePath }) {
3358
3430
 
3359
3431
  const activeFaqs = tabs.find(tab => tab.title === activeTab);
3360
3432
 
3433
+ const renderFaqItem = (faqItem) => {
3434
+ // If item has a link, render as a clickable link row (same style as FAQ question)
3435
+ if (faqItem.link) {
3436
+ return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3437
+ className: "faqs-box-item",
3438
+ children: (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("a", {
3439
+ href: faqItem.link,
3440
+ className: "faqs-item-question faqs-item-link",
3441
+ children: [
3442
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
3443
+ children: faqItem.title || faqItem.question
3444
+ }),
3445
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
3446
+ children: (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("i", {
3447
+ className: "fa-solid fa-arrow-up-right-from-square"
3448
+ })
3449
+ })
3450
+ ]
3451
+ })
3452
+ }, faqItem.title || faqItem.question);
3453
+ }
3454
+
3455
+ // Otherwise render as expandable FAQ
3456
+ return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3457
+ children: [
3458
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
3459
+ children: [
3460
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
3461
+ children: faqItem.question,
3462
+ }),
3463
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
3464
+ children: (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("i", {
3465
+ className: "fa-solid fa-chevron-down",
3466
+ }),
3467
+ onClick: (e) => {
3468
+ if (document.querySelector('.faqs-item-answer')) {
3469
+ if (e.currentTarget.parentElement.nextElementSibling.style.display === 'none') {
3470
+ e.currentTarget.parentElement.nextElementSibling.style.display = 'block';
3471
+ e.currentTarget.querySelector('i').className = "fa-solid fa-chevron-up";
3472
+ }
3473
+ else {
3474
+ e.currentTarget.parentElement.nextElementSibling.style.display = 'none';
3475
+ e.currentTarget.querySelector('i').className = "fa-solid fa-chevron-down";
3476
+ }
3477
+ }
3478
+ },
3479
+ }),
3480
+ ],
3481
+ className: "faqs-item-question",
3482
+ }),
3483
+ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
3484
+ dangerouslySetInnerHTML: {
3485
+ __html: faqItem.answer
3486
+ },
3487
+ className: "faqs-item-answer",
3488
+ style: {
3489
+ display: "none",
3490
+ }
3491
+ }),
3492
+ ],
3493
+ className: "faqs-box-item",
3494
+ }, faqItem.question);
3495
+ };
3496
+
3361
3497
  return tabs.length > 0 ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3362
3498
  className: "faqs-div",
3363
3499
  children: [
@@ -3374,47 +3510,7 @@ function HomepageFaqs({ frontmatter, routePath }) {
3374
3510
  }),
3375
3511
  // Content FAQ
3376
3512
  activeFaqs ? (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3377
- children: activeFaqs.items.map((faqItem) => {
3378
- return (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("div", {
3379
- children: [
3380
- (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
3381
- children: [
3382
- (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
3383
- children: faqItem.question,
3384
- }),
3385
- (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("span", {
3386
- children: (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("i", {
3387
- className: "fa-solid fa-chevron-down",
3388
- }),
3389
- onClick: (e) => {
3390
- if (document.querySelector('.faqs-item-answer')) {
3391
- if (e.currentTarget.parentElement.nextElementSibling.style.display === 'none') {
3392
- e.currentTarget.parentElement.nextElementSibling.style.display = 'block';
3393
- e.currentTarget.querySelector('i').className = "fa-solid fa-chevron-up";
3394
- }
3395
- else {
3396
- e.currentTarget.parentElement.nextElementSibling.style.display = 'none';
3397
- e.currentTarget.querySelector('i').className = "fa-solid fa-chevron-down";
3398
- }
3399
- }
3400
- },
3401
- }),
3402
- ],
3403
- className: "faqs-item-question",
3404
- }),
3405
- (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime_225474f2__.jsx)("p", {
3406
- dangerouslySetInnerHTML: {
3407
- __html: faqItem.answer
3408
- },
3409
- className: "faqs-item-answer",
3410
- style: {
3411
- display: "none",
3412
- }
3413
- }),
3414
- ],
3415
- className: "faqs-box-item",
3416
- }, faqItem.question);
3417
- }),
3513
+ children: activeFaqs.items.map((faqItem) => renderFaqItem(faqItem)),
3418
3514
  className: "faqs-box"
3419
3515
  }) : null,
3420
3516
  ],
@@ -6976,4 +7072,4 @@ async function exportContentToPDF() {
6976
7072
  });
6977
7073
  }
6978
7074
 
6979
- export { Aside, Badge, Button, Card, DocFooter, DocLayout, EditLink, HomeFeature, HomeFooter, HomeLayout, HomepageLayout, GettingStartLayout, RequestArticleLayout, HomepageTopSearch, IntroBanner, HomepageTopics, HomepageFeatures, HomepageFeaturesTabs, WhatsNew, HomepageFaqs, LastUpdated, Layout, Link, LinkCard, Nav, NotFoundLayout, Overview, PackageManagerTabs, PrevNextPage, types_RenderType as RenderType, ScrollToTop, Search, SearchPanel, Sidebar, SidebarList, SocialLinks, SourceCode, Steps, SwitchAppearance, Tab, Tabs, Tag, Toc, bindingAsideScroll, src_rslib_entry_ as default, getCustomMDXComponent, isMobileDevice, parseInlineMarkdownText, renderHtmlOrText, renderInlineMarkdown, scrollToTarget, setup, useEditLink, useEnableNav, useFullTextSearch, useHiddenNav, useLocaleSiteData, usePathUtils, usePrevNextPage, useRedirect4FirstVisit, useSidebarData, useThemeState };
7075
+ export { Aside, Badge, Button, Card, DocFooter, DocLayout, EditLink, HomeFeature, HomeFooter, HomeLayout, HomepageLayout, GettingStartLayout, RequestArticleLayout, HomepageTopSearch, IntroBanner, HomepageTopics, HomepageFeatures, HomepageFeaturesTabs, PopularTopicsSection, WhatsNew, HomepageFaqs, LastUpdated, Layout, Link, LinkCard, Nav, NotFoundLayout, Overview, PackageManagerTabs, PrevNextPage, types_RenderType as RenderType, ScrollToTop, Search, SearchPanel, Sidebar, SidebarList, SocialLinks, SourceCode, Steps, SwitchAppearance, Tab, Tabs, Tag, Toc, bindingAsideScroll, src_rslib_entry_ as default, getCustomMDXComponent, isMobileDevice, parseInlineMarkdownText, renderHtmlOrText, renderInlineMarkdown, scrollToTarget, setup, useEditLink, useEnableNav, useFullTextSearch, useHiddenNav, useLocaleSiteData, usePathUtils, usePrevNextPage, useRedirect4FirstVisit, useSidebarData, useThemeState };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rspress-theme-anatole/theme-default",
3
3
  "author": "Anatole Tong",
4
- "version": "0.7.24",
4
+ "version": "0.7.25",
5
5
  "license": "MIT",
6
6
  "sideEffects": [
7
7
  "*.css",
@@ -21,8 +21,8 @@
21
21
  "types": "./dist/bundle.d.ts",
22
22
  "dependencies": {
23
23
  "@mdx-js/react": "2.3.0",
24
- "@rspress-theme-anatole/rspress-plugin-mermaid": "0.7.24",
25
- "@rspress-theme-anatole/shared": "0.7.24",
24
+ "@rspress-theme-anatole/rspress-plugin-mermaid": "0.7.25",
25
+ "@rspress-theme-anatole/shared": "0.7.25",
26
26
  "@rspress/runtime": "1.43.8",
27
27
  "body-scroll-lock": "4.0.0-beta.0",
28
28
  "copy-to-clipboard": "^3.3.3",