Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto copy header link #4411

Merged
merged 24 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8306a1a
test
mirnawong1 Nov 7, 2023
9620322
Merge branch 'current' into mwong-auto-copy-header
mirnawong1 Nov 8, 2023
583ffe4
updates
mirnawong1 Nov 8, 2023
6fe2e77
updates
mirnawong1 Nov 9, 2023
22bf197
Merge branch 'current' into mwong-auto-copy-header
mirnawong1 Nov 9, 2023
d7055b2
Merge branch 'current' into mwong-auto-copy-header
mirnawong1 Nov 10, 2023
5e6cbc4
commit message
mirnawong1 Nov 10, 2023
48817d5
Merge branch 'current' into mwong-auto-copy-header
mirnawong1 Nov 10, 2023
efb11cf
add pop upfix
mirnawong1 Nov 10, 2023
f92efe9
fix load
mirnawong1 Nov 13, 2023
e0764c5
adding badge but broken
mirnawong1 Nov 13, 2023
4060af1
revert to original
mirnawong1 Nov 13, 2023
fae19c9
Merge branch 'current' into mwong-auto-copy-header
mirnawong1 Nov 13, 2023
76ef638
add
mirnawong1 Nov 13, 2023
d4ea9db
Merge branch 'current' into mwong-auto-copy-header
mirnawong1 Nov 13, 2023
dba2bfc
Update website/docs/docs/collaborate/documentation.md
mirnawong1 Nov 13, 2023
fc04876
Merge branch 'current' into mwong-auto-copy-header
mirnawong1 Nov 15, 2023
79a6a4d
final tweaks
mirnawong1 Nov 15, 2023
df10e0c
Merge branch 'current' into mwong-auto-copy-header
mirnawong1 Nov 15, 2023
5fad4ee
Merge branch 'current' into mwong-auto-copy-header
mirnawong1 Nov 15, 2023
3acceed
add new eventlistener
mirnawong1 Nov 15, 2023
d879035
Merge branch 'current' into mwong-auto-copy-header
mirnawong1 Nov 15, 2023
08cfc34
Merge branch 'current' into mwong-auto-copy-header
mirnawong1 Nov 15, 2023
779e572
Merge branch 'current' into mwong-auto-copy-header
mirnawong1 Nov 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions website/docs/docs/collaborate/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pagination_next: "docs/collaborate/build-and-view-your-docs"
pagination_prev: null
---

## Related documentation
## Related documentation <ReleaseStatus status="Beta" />

* [Declaring properties](/reference/configs-and-properties)
* [`dbt docs` command](/reference/commands/cmd-docs)
Expand All @@ -17,7 +17,7 @@ pagination_prev: null

* [Tests](/docs/build/tests)

## Overview
## Overview

Good documentation for your dbt models will help downstream consumers discover and understand the datasets which you curate for them.

Expand Down
5 changes: 4 additions & 1 deletion website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const path = require("path");
const math = require("remark-math");
const katex = require("rehype-katex");
const { versions, versionedPages, versionedCategories } = require("./dbt-versions");
const reactPlugin = import('remark-react');
require("dotenv").config();

/* Debugging */
Expand Down Expand Up @@ -215,7 +216,7 @@ var siteSettings = {
path: "docs",
routeBasePath: "/",
sidebarPath: require.resolve("./sidebars.js"),
remarkPlugins: [math],
remarkPlugins: [math, reactPlugin],
rehypePlugins: [katex],

editUrl:
Expand Down Expand Up @@ -258,6 +259,8 @@ var siteSettings = {
src: "https://cdn.jsdelivr.net/npm/[email protected]/release/featherlight.min.js",
defer: true,
},
"https://cdn.jsdelivr.net/npm/[email protected]/dist/clipboard.min.js",
"/js/headerLinkCopy.js",
"/js/gtm.js",
"/js/onetrust.js",
"https://kit.fontawesome.com/7110474d41.js",
Expand Down
25,536 changes: 3,639 additions & 21,897 deletions website/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@svgr/webpack": "^6.0.0",
"axios": "^0.27.2",
"classnames": "^2.3.1",
"clipboard": "^2.0.11",
"clsx": "^1.1.1",
"color": "^3.1.2",
"core-js": "^3.20.0",
Expand All @@ -43,6 +44,7 @@
"redoc": "^2.0.0-rc.57",
"rehype-katex": "^5.0.0",
"remark-math": "^3.0.1",
"remark-react": "^9.0.1",
"sanitize-html": "^2.8.0",
"slugify": "^1.6.1",
"styled-components": "5.3.3",
Expand Down
13 changes: 13 additions & 0 deletions website/src/components/lifecyclePill/ReleaseStatus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// ReleaseStatus.js
import React from 'react';
import './custom.css'; // import path

function ReleaseStatus({ status }) {
return (
<div className={`release-status release-status-${status.toLowerCase()}`}>
{status}
</div>
);
}

export default ReleaseStatus;
62 changes: 62 additions & 0 deletions website/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -2034,6 +2034,68 @@ html[data-theme="dark"] .theme-doc-sidebar-container>div>button.button:hover {
color: #818589; /* You can adjust the color as needed */
}

h3.anchor a.hash-link:before,
h2.anchor a.hash-link:before {
content: "";
background-image: url('/img/copy.png');
background-size: 18px 18px;
height: 18px;
width: 18px;
display: inline-block;
}

h3.anchor.clicked a.hash-link:before,
h2.anchor.clicked a.hash-link:before {
background-image: url('/img/check.png');
background-size: 18px 13px;
height: 13px;
}

.copy-popup {
position: fixed;
top: 10px;
left: 50%;
transform: translateX(-50%);
background-color: #047377;
color: rgb(236, 236, 236);
padding: 10px;
border-radius: 5px;
z-index: 9999;
}

.close-button {
cursor: pointer;
margin-right: 10px;
font-size: 20px;
}
mirnawong1 marked this conversation as resolved.
Show resolved Hide resolved

.close-button:hover {
color: #fff; /* Change color on hover if desired */
}

.release-status {
display: inline-block;
padding: 4px 8px;
border-radius: 4px;
font-size: 0.8em;
margin-right: 8px;
}

.release-status-beta {
background-color:lightgreen; /* Adjust the color as needed */
color: #eae6e6;
}

.release-status-public-preview {
background-color: #4caf50; /* Adjust the color as needed */
color: #fff;
}

.release-status-private-preview {
background-color: #2196f3; /* Adjust the color as needed */
color: #fff;
}

@media (max-width: 996px) {
.quickstart-container {
flex-direction: column;
Expand Down
Binary file added website/static/img/check.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added website/static/img/copy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
52 changes: 52 additions & 0 deletions website/static/js/headerLinkCopy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/* eslint-disable */

// Get all the headers with anchor links
window.addEventListener("load", function() {
const headers = document.querySelectorAll("h2.anchor, h3.anchor");

headers.forEach((header) => {
header.style.cursor = "pointer";
const clipboard = new ClipboardJS(header, {
text: function(trigger) {
const anchorLink = trigger.getAttribute("id");
return window.location.href.split('#')[0] + '#' + anchorLink;
}
});

clipboard.on('success', function(e) {
// Provide user feedback (e.g., alert or tooltip) here
const popup = document.createElement('div');
popup.classList.add('copy-popup');
popup.innerText = 'Link copied!';
document.body.appendChild(popup);

// Set up timeout to remove the popup after 5 seconds
setTimeout(() => {
document.body.removeChild(popup);
}, 5000);

// Add close button ('x')
const closeButton = document.createElement('span');
closeButton.classList.add('close-button');
closeButton.innerHTML = ' &times;'; // '×' symbol for 'x'
closeButton.addEventListener('click', () => {
if (document.body.contains(popup)) {
document.body.removeChild(popup);
}
});
popup.appendChild(closeButton);

// Add and remove the 'clicked' class for styling purposes
e.trigger.classList.add("clicked");
setTimeout(() => {
if (document.body.contains(popup)) {
document.body.removeChild(popup);
}
}, 5000);
});

clipboard.on('error', function(e) {
console.error("Unable to copy to clipboard: " + e.text);
});
});
});
Loading