@apify/docs-theme 1.0.249 → 1.0.250

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apify/docs-theme",
3
- "version": "1.0.249",
3
+ "version": "1.0.250",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "files": [
package/src/config.js CHANGED
@@ -285,6 +285,34 @@ const themeConfig = {
285
285
  async: true,
286
286
  defer: true,
287
287
  },
288
+ announcementBar: process.env.APIFY_DOCS_ABSOLUTE_URL
289
+ ? (() => {
290
+ const parsedUrl = new URL(process.env.APIFY_DOCS_ABSOLUTE_URL);
291
+
292
+ const { hostname } = parsedUrl;
293
+
294
+ if (!hostname.includes('pr-') && !hostname.includes('preview')) {
295
+ return undefined;
296
+ }
297
+
298
+ const prNumber = hostname.split('.')[0]?.split('-')[1];
299
+
300
+ if (!prNumber) {
301
+ return undefined;
302
+ }
303
+
304
+ // TODO: once we support multiple preview deployments, we should pass in the repository name as an env variable
305
+ const githubUrl = `https://github.com/apify/apify-docs/pull/${prNumber}`;
306
+
307
+ return {
308
+ id: 'apify-docs-preview-banner',
309
+ content: `You are visiting <a href="${githubUrl}" target="_blank" rel="noopener noreferrer">a preview build for PR ${prNumber}</a> of the Apify Docs.`,
310
+ backgroundColor: '#B80F0A',
311
+ textColor: '#FFFFFF',
312
+ isCloseable: false,
313
+ };
314
+ })()
315
+ : undefined,
288
316
  };
289
317
 
290
318
  const plugins = [
@@ -967,6 +967,20 @@ nav.navbar[class*='navbarHidden'] {
967
967
  transform: translate3d(0, calc(-210%), 0);
968
968
  }
969
969
 
970
+ /* Pin the announcement bar to the top of the viewport and push the
971
+ navbar down so it sits below the bar instead of sliding under it.
972
+ The sibling selector keeps the navbar at top: 0 when there is no
973
+ announcement bar (e.g. production builds). */
974
+ div[class*='announcementBar_'] {
975
+ position: sticky;
976
+ top: 0;
977
+ z-index: calc(var(--ifm-z-index-fixed) + 1);
978
+ }
979
+
980
+ div[class*='announcementBar_'] ~ nav.navbar {
981
+ top: var(--docusaurus-announcement-bar-height);
982
+ }
983
+
970
984
  .navbar__items--right a.icon,
971
985
  div[class*='colorModeToggle'] {
972
986
  display: initial;