You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2024/02/20 20:04:14 UTC

(superset) branch docs-edit-button updated: swizzled button

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch docs-edit-button
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/docs-edit-button by this push:
     new 75df872e26 swizzled button
75df872e26 is described below

commit 75df872e26df39b5a9611b038cbcd1c5f43cd80e
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Tue Feb 20 13:04:04 2024 -0700

    swizzled button
---
 docs/docusaurus.config.js       |  2 +-
 docs/src/styles/main.less       | 10 ++++++++++
 docs/src/theme/DocItem/index.js | 39 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js
index d0cc8679d0..d7dc1c931c 100644
--- a/docs/docusaurus.config.js
+++ b/docs/docusaurus.config.js
@@ -139,7 +139,7 @@ const config = {
       ({
         docs: {
           sidebarPath: require.resolve('./sidebars.js'),
-          editUrl: 'https://github.com/apache/superset/tree/master/docs',
+          editUrl: 'https://github.com/apache/superset/edit/master/docs',
         },
         blog: {
           showReadingTime: true,
diff --git a/docs/src/styles/main.less b/docs/src/styles/main.less
index d10047fdea..f7d053f9c9 100644
--- a/docs/src/styles/main.less
+++ b/docs/src/styles/main.less
@@ -259,3 +259,13 @@ a > span > svg {
     height: 28px;
   }
 }
+
+/* Edit Button */
+
+.edit-page-link {
+  position: sticky;
+  bottom: 0px;
+  right: 0px;
+  border-radius: 10px;
+  background-color: #ccc;
+}
diff --git a/docs/src/theme/DocItem/index.js b/docs/src/theme/DocItem/index.js
new file mode 100644
index 0000000000..b78976a334
--- /dev/null
+++ b/docs/src/theme/DocItem/index.js
@@ -0,0 +1,39 @@
+import React from 'react';
+import styled from '@emotion/styled';
+import DocItem from '@theme-original/DocItem';
+
+const EditPageLink = styled('a')`
+  position: fixed;
+  bottom: 20px;
+  right: 20px;
+  padding: 1rem;
+  padding-left: 4rem;
+  background-color: #444;
+  border-radius: 10px;
+  z-index: 9999;
+  background-image: url('/img/github-dark.png');
+  background-size: 2rem;
+  background-position: 1rem center;
+  background-repeat: no-repeat;
+  transition: background-color 0.3s; /* Smooth transition for hover effect */
+  bpx-shadow: 0 0 0 0 rgba(0,0,0,0); /* Smooth transition for hover effect */
+  scale: .9;
+  transition: all 0.3s;
+
+  &:hover {
+    background-color: #333;
+    box-shadow: 5px 5px 10px 0 rgba(0,0,0,0.3);
+    scale: 1;
+  }
+`;
+
+export default function DocItemWrapper(props) {
+  return (
+    <>
+      <EditPageLink href={props.content.metadata.editUrl} target="_blank" rel="noopener noreferrer">
+        Edit this page on GitHub
+      </EditPageLink>
+      <DocItem {...props} />
+    </>
+  );
+}