Skip to content

🎥 Make videos programmatically with React

Elements: Refine mobile catalog layout

Igor Samokhovets932851d840f2
diff --git a/packages/docs/elements/index.mdx b/packages/docs/elements/index.mdx
index a034119c54..34a8417a19 100644
--- a/packages/docs/elements/index.mdx
+++ b/packages/docs/elements/index.mdx
@@ -12,7 +12,7 @@ import {CatalogHero} from '@site/src/components/Catalog/CatalogHero';
import {ElementLibrary} from '@site/src/components/Elements/ElementLibrary';
<CatalogHero title="Remotion Elements">
-Drop-in video building blocks. Make it yours,<br /> [interactively](/docs/studio/interactivity) or [with an agent](/docs/ai).
+<span className="catalog-lead">Drop-in video building blocks.</span> Make it yours,<br /> [interactively](/docs/studio/interactivity) or [with an agent](/docs/ai).
</CatalogHero>
<ElementLibrary category={null} />
diff --git a/packages/docs/src/components/Catalog/CatalogHero.module.css b/packages/docs/src/components/Catalog/CatalogHero.module.css
index 34b2109408..4b49986be2 100644
--- a/packages/docs/src/components/Catalog/CatalogHero.module.css
+++ b/packages/docs/src/components/Catalog/CatalogHero.module.css
@@ -45,7 +45,20 @@
}
.hero .description {
- font-size: 1.25rem;
+ font-size: clamp(1rem, 4.3vw, 1.125rem);
+ line-height: 1.6;
+ }
+
+ .description :global(.catalog-lead) {
+ display: block;
+ }
+
+ .description br {
+ display: none;
+ }
+
+ .description a {
+ white-space: nowrap;
}
}
@@ -63,4 +76,13 @@
:global(.studio-elements-embed) .hero .description {
max-width: 56ch;
font-size: 1rem;
+ line-height: 1.8;
+}
+
+:global(.studio-elements-embed) .description :global(.catalog-lead) {
+ display: inline;
+}
+
+:global(.studio-elements-embed) .description br {
+ display: initial;
}
diff --git a/packages/docs/src/components/Elements/ElementLibrary.module.css b/packages/docs/src/components/Elements/ElementLibrary.module.css
index 6a9e85808e..e0c7586e70 100644
--- a/packages/docs/src/components/Elements/ElementLibrary.module.css
+++ b/packages/docs/src/components/Elements/ElementLibrary.module.css
@@ -111,7 +111,7 @@
.grid {
display: grid;
- grid-template-columns: minmax(0, 1fr);
+ grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
margin: 0;
padding: 0;
@@ -210,31 +210,22 @@
.content {
min-width: 0;
- padding: 18px 0;
+ padding: 8px 0;
}
.title {
display: block;
margin: 0;
font-family: 'GTPlanar';
- font-size: 1.125rem;
+ font-size: 1rem;
font-weight: 400;
text-wrap: balance;
}
@container element-library (min-width: 600px) {
.grid {
- grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 24px;
}
-
- .content {
- padding: 8px 0;
- }
-
- .title {
- font-size: 1rem;
- }
}
@container element-library (min-width: 858px) {
diff --git a/packages/docs/src/css/catalog.css b/packages/docs/src/css/catalog.css
index c317f031d0..8082f380e4 100644
--- a/packages/docs/src/css/catalog.css
+++ b/packages/docs/src/css/catalog.css
@@ -47,7 +47,8 @@
}
.catalog-layout .menu__link:focus-visible,
-.catalog-layout .menu__caret:focus-visible {
+.catalog-layout .menu__caret:focus-visible,
+.catalog-layout .navbar-sidebar__back:focus-visible {
outline: 2px solid var(--ifm-color-primary);
outline-offset: 2px;
}
@@ -106,6 +107,13 @@
.catalog-layout .menu__link {
min-height: 44px;
}
+
+ .catalog-layout .navbar-sidebar__back {
+ width: 100%;
+ min-height: 44px;
+ margin: 0;
+ padding: 8px 12px;
+ }
}
/* Studio uses the same cards in a denser, application-sized catalog. */
diff --git a/packages/docs/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx b/packages/docs/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx
new file mode 100644
index 0000000000..ac749efdec
--- /dev/null
+++ b/packages/docs/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+import {useThemeConfig} from '@docusaurus/theme-common';
+import {useNavbarSecondaryMenu} from '@docusaurus/theme-common/internal';
+import Translate from '@docusaurus/Translate';
+import React, {type ReactNode} from 'react';
+
+export default function NavbarMobileSidebarSecondaryMenu(): ReactNode {
+ const isPrimaryMenuEmpty = useThemeConfig().navbar.items.length === 0;
+ const secondaryMenu = useNavbarSecondaryMenu();
+
+ return (
+ <>
+ {!isPrimaryMenuEmpty && (
+ <button
+ className="clean-btn navbar-sidebar__back"
+ onClick={() => secondaryMenu.hide()}
+ type="button"
+ >
+ <Translate
+ id="theme.navbar.mobileSidebarSecondaryMenu.backButtonText"
+ description="The label of the button to return from the docs sidebar to the main mobile menu, without the back arrow"
+ >
+ Back to main menu
+ </Translate>
+ </button>
+ )}
+ {secondaryMenu.content}
+ </>
+ );
+}