-
Notifications
You must be signed in to change notification settings - Fork 944
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #448 from dbt-labs/repo-sync
REPO SYNC - Public to Private
- Loading branch information
Showing
8 changed files
with
167 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* eslint-disable */ | ||
|
||
import React, { useState } from 'react'; | ||
import styles from './styles.module.css'; | ||
|
||
function slugify(text) { | ||
return text.toString().toLowerCase() | ||
.normalize('NFD') // Normalize to NFD Unicode form | ||
.replace(/[\u0300-\u036f]/g, '') // Remove diacritics | ||
.replace(/\s+/g, '-') // Replace spaces with - | ||
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | ||
.replace(/\-\-+/g, '-') // Replace multiple - with single - | ||
.replace(/^-+/, '') // Trim - from start | ||
.replace(/-+$/, ''); // Trim - from end | ||
} | ||
|
||
function expandable({ children, alt_header = null }) { | ||
if(!alt_header) { return null; } | ||
const [isOn, setOn] = useState(false); | ||
// generate a slug from the alt_header | ||
const anchorId = slugify(alt_header); | ||
|
||
const handleToggleClick = (event) => { | ||
event.preventDefault(); | ||
setOn(current => !current); | ||
}; | ||
|
||
return ( | ||
<div id={anchorId} className={`${styles.expandableContainer} ${styles.local} expandable-anchor anchor`}> | ||
<a | ||
href={`#${anchorId}`} | ||
className={styles.link} | ||
onClick={handleToggleClick} | ||
role="button" | ||
tabIndex="0" | ||
> | ||
<span className={`${styles.toggle} ${isOn ? styles.toggleDown : styles.toggleRight}`}></span> | ||
| ||
<span className={styles.headerText}>{alt_header}</span> | ||
</a> | ||
<div | ||
style={{ display: isOn ? 'block' : 'none' }} | ||
className={styles.body} | ||
> | ||
{children} | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default expandable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
:local(.link) :local(.headerText) { | ||
content: ''; | ||
color: black; /* Black text in normal mode */ | ||
text-decoration: none; | ||
transition: text-decoration 0.3s; /* Smooth transition */ | ||
font-weight: 600; | ||
margin-bottom: 20px; | ||
} | ||
|
||
:local(.link:hover) :local(.headerText), | ||
:local(.link:focus) :local(.headerText) { | ||
text-decoration: underline; | ||
cursor: pointer; | ||
} | ||
|
||
:local(.toggle)::before { | ||
content: ''; | ||
display: inline-block; | ||
border: solid black; /* Arrow color */ | ||
border-width: 0 2px 2px 0; /* Adjust for 'boldness' */ | ||
padding: 3px; /* Adjust size */ | ||
transform: rotate(45deg); /* Initial right-pointing arrow */ | ||
transition: transform 0.3s; /* Smooth transition for toggle icon */ | ||
margin-right: 8px; | ||
} | ||
|
||
:local(.toggleDown)::before { | ||
transform: rotate(225deg); /* Downward arrow */ | ||
} | ||
|
||
:local(.toggleRight)::before { | ||
transform: rotate(315deg); /* Right-pointing arrow */ | ||
} | ||
|
||
:local(.toggle)::before { | ||
border-color: rgb(253, 153, 83); /* Orange arrow color in light mode */ | ||
} | ||
|
||
/* Adjusting for Light and Dark Modes */ | ||
:local(html[data-theme='dark'] .link), :local(html[data-theme='dark'] .headerText) { | ||
color: white; /* White text in dark mode */ | ||
} | ||
|
||
:local(html[data-theme='dark'] .toggle)::before { | ||
border-color: white; /* White arrow in dark mode */ | ||
border-color: rgb(253, 153, 83); | ||
} | ||
|
||
.expandableContainer :local(.body) { | ||
margin-top: 10px; | ||
margin-left: .5em; | ||
padding: 10px; | ||
background-color: transparent; | ||
} | ||
|
||
:local(html[data-theme='dark'] .link), | ||
:local(html[data-theme='dark'] .headerText) { | ||
color: white; /* White text in dark mode */ | ||
} | ||
|
||
:local(.body > p:last-child) { | ||
margin-bottom: 0px; | ||
|
||
} | ||
|
||
:local(.link)::after { | ||
content: ""; | ||
display: inline-block; | ||
width: 12px; | ||
height: 12px; | ||
background-image: url('/img/copy.png'); | ||
background-size: contain; | ||
background-repeat: no-repeat; | ||
opacity: 0; /* Start with icon hidden */ | ||
transition: opacity 0.3s ease-in-out; | ||
margin-left: 8px; | ||
} | ||
|
||
:local(.link:not(.toggleOpen)):hover::after { | ||
opacity: 1; /* Only show icon on hover when toggle is not open */ | ||
} | ||
|
||
.expandableContainer { | ||
margin-bottom: 10px; /* Adjust this value as needed to create space */ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters