diff --git a/packages/gatsby-theme-iterative/src/components/Documentation/Layout/styles.module.css b/packages/gatsby-theme-iterative/src/components/Documentation/Layout/styles.module.css
index fc3effed..841a44a0 100644
--- a/packages/gatsby-theme-iterative/src/components/Documentation/Layout/styles.module.css
+++ b/packages/gatsby-theme-iterative/src/components/Documentation/Layout/styles.module.css
@@ -1,9 +1,11 @@
.container {
display: flex;
flex-direction: row;
+ flex: 1;
z-index: 2;
+ height: 100%;
- @media (--xs-scr) {
+ @media screen(xsMax) {
padding: 0 15px;
}
@@ -19,7 +21,7 @@
pointer-events: none;
background-color: var(--color-light-blue);
- @media (--xs-scr) {
+ @media screen(xsMax) {
display: none;
}
}
@@ -28,7 +30,7 @@
.backdrop {
display: none;
- @media (--xs-scr) {
+ @media screen(xsMax) {
display: block;
opacity: 0;
pointer-events: none;
@@ -50,26 +52,34 @@
}
.side {
- flex-shrink: 0;
- width: 280px;
+ @apply flex flex-col w-72
+ sm:py-0;
background-color: var(--color-light-blue);
- @media (--xs-scr) {
- position: fixed;
- display: block;
- z-index: 2;
- top: var(--layout-header-height);
- bottom: 0;
- left: 0;
- right: 60px;
- box-shadow: rgb(0 0 0 / 14%) 0 0 4px, rgb(0 0 0 / 28%) 0 4px 8px;
- transform: translateX(-110%);
- transition: transform 0.35s ease;
+ flex-shrink: 0;
- &.opened {
- transform: translateX(0);
- }
+ position: fixed;
+ z-index: 2;
+ bottom: 0;
+ left: 0;
+ box-shadow: rgb(0 0 0 / 14%) 0 0 4px, rgb(0 0 0 / 28%) 0 4px 8px;
+ transform: translateX(-110%);
+ transition: transform 0.35s ease;
+
+ &.opened {
+ transform: translateX(0);
}
+
+ @media screen(xs) {
+ position: static;
+ transform: none;
+ box-shadow: none;
+ width: 280px;
+ }
+}
+
+.innerSidebar {
+ @apply flex flex-col h-screen pt-14 xs:sticky xs:h-auto xs:max-h-screen xs:top-0 z-20;
}
.sideToggle {
@@ -77,7 +87,7 @@
justify-content: center;
align-items: center;
position: fixed;
- z-index: 2;
+ z-index: 3;
left: 8px;
bottom: 20px;
width: 45px;
@@ -92,7 +102,7 @@
transform: translateX(calc(100vw - 60px));
}
- @media (--xs-scr) {
+ @media screen(xsMax) {
display: flex;
> * {
@@ -108,7 +118,7 @@
background-color: #fff;
flex: 1;
- @media (--xs-scr) {
+ @media screen(xsMax) {
max-width: 100%;
}
}
diff --git a/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/Main/styles.module.css b/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/Main/styles.module.css
index 347c3434..30ff6da7 100644
--- a/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/Main/styles.module.css
+++ b/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/Main/styles.module.css
@@ -1,16 +1,4 @@
:global {
- ul {
- list-style-type: disc;
- }
-
- ol {
- list-style-type: decimal;
- }
-
- em {
- font-style: italic;
- }
-
#markdown-root {
@keyframes fadeIn {
from {
@@ -34,6 +22,22 @@
font-family: inherit;
font-size: 18px;
+ ul {
+ list-style: disc;
+ }
+
+ ol {
+ list-style: decimal;
+ }
+
+ em {
+ font-style: italic;
+ }
+
+ h1:first-child {
+ @apply lg:h-14 pb-2;
+ }
+
h1,
h2,
h3,
@@ -41,6 +45,7 @@
h5,
h6 {
font-weight: 500;
+ word-wrap: normal;
}
img + em,
@@ -114,6 +119,10 @@
.anchor {
margin-left: -24px;
+
+ svg {
+ display: inline;
+ }
}
li {
@@ -165,7 +174,7 @@
&__tooltip {
padding: 10px;
- box-sizing: border-box;
+
color: #fff;
opacity: 0;
width: 100%;
@@ -179,7 +188,7 @@
}
a {
- @mixin focus;
+ @apply focus;
color: #fff;
text-decoration: underline;
@@ -193,14 +202,10 @@
}
.content {
+ @apply py-7 xs:px-7 mt-14;
min-width: 200px;
- margin: 30px;
flex: 1;
background-color: #fff;
-
- @media (--xs-scr) {
- margin: 15px 0;
- }
}
.tutorialsWrapper {
@@ -209,7 +214,7 @@
float: right;
margin: 5px 0 0 10px;
- @media (--md-scr) {
+ @media screen(mdMax) {
margin: 0 0 15px;
}
@@ -225,7 +230,7 @@
z-index: 1;
position: relative;
- @media (--md-scr) {
+ @media screen(mdMax) {
float: none;
margin: 0 0 15px;
}
diff --git a/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/Tooltip/DesktopView/index.tsx b/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/Tooltip/DesktopView/index.tsx
index 3a69b1ba..06b29973 100644
--- a/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/Tooltip/DesktopView/index.tsx
+++ b/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/Tooltip/DesktopView/index.tsx
@@ -3,7 +3,6 @@ import cn from 'classnames'
import Portal from '@reach/portal'
import throttle from 'lodash/throttle'
-import { getHeaderHeight } from '../../../../../utils/front/scroll'
import * as styles from './styles.module.css'
interface IDesktopViewProps {
@@ -24,7 +23,6 @@ const getPosition = (toggle: Element, tooltip: Element): ITooltipPosition => {
const toggleRect = toggle.getBoundingClientRect()
const tooltipRect = tooltip.getBoundingClientRect()
const windowWidth = document.documentElement.clientWidth
- const headerHeight = getHeaderHeight()
const result: ITooltipPosition = { left: 0, top: 0, arrow: ['l', 'b'] }
if (windowWidth - tooltipRect.width > toggleRect.left) {
@@ -34,7 +32,7 @@ const getPosition = (toggle: Element, tooltip: Element): ITooltipPosition => {
result.arrow[0] = 'r'
}
- if (toggleRect.top > tooltipRect.height + ARROW_SIZE + headerHeight) {
+ if (toggleRect.top > tooltipRect.height + ARROW_SIZE) {
result.top = toggleRect.top - tooltipRect.height - ARROW_SIZE
} else {
result.top = toggleRect.top + toggleRect.height + ARROW_SIZE
diff --git a/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/Tooltip/DesktopView/styles.module.css b/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/Tooltip/DesktopView/styles.module.css
index 37cea78d..b0c2bf18 100644
--- a/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/Tooltip/DesktopView/styles.module.css
+++ b/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/Tooltip/DesktopView/styles.module.css
@@ -4,7 +4,6 @@
}
.tooltip {
- box-sizing: border-box;
position: fixed;
top: 0;
left: 0;
diff --git a/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/styles.module.css b/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/styles.module.css
index 9f2a4912..7e96fec5 100644
--- a/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/styles.module.css
+++ b/packages/gatsby-theme-iterative/src/components/Documentation/Markdown/styles.module.css
@@ -75,14 +75,12 @@
height: 100%;
flex-flow: row nowrap;
align-items: center;
- box-sizing: border-box;
p {
margin: 0;
}
.cardIcon {
- box-sizing: border-box;
display: block;
padding: 0;
padding-right: 0.75rem;
diff --git a/packages/gatsby-theme-iterative/src/components/Documentation/RightPanel/index.tsx b/packages/gatsby-theme-iterative/src/components/Documentation/RightPanel/index.tsx
index bea39126..9a45ffdb 100644
--- a/packages/gatsby-theme-iterative/src/components/Documentation/RightPanel/index.tsx
+++ b/packages/gatsby-theme-iterative/src/components/Documentation/RightPanel/index.tsx
@@ -6,7 +6,7 @@ import { IHeading } from '../'
import Link from '../../Link'
import Tutorials from '../TutorialsLinks'
-import { getScrollPosition, getHeaderHeight } from '../../../utils/front/scroll'
+import { getScrollPosition } from '../../../utils/front/scroll'
import { allImagesLoadedInContainer } from '../../../utils/front/images'
import * as sharedStyles from '../styles.module.css'
@@ -40,11 +40,8 @@ const RightPanel: React.FC
= ({
if (!coordinateKeys.length) return
- const headerHeight = getHeaderHeight()
const filteredKeys = coordinateKeys.filter(
- offsetTop =>
- parseInt(offsetTop, 10) <=
- currentScroll + (documentHeight - headerHeight) / 2
+ offsetTop => parseInt(offsetTop, 10) <= currentScroll + documentHeight / 2
)
const newCurrentHeadingSlug = filteredKeys.length
@@ -92,36 +89,35 @@ const RightPanel: React.FC = ({
useEffect(updateCurrentHeader, [headingsOffsets, documentHeight])
const contentBlockRef = useRef(null)
- const [
- isScrollToCurrentHeadingHappened,
- setIsScrollToCurrentHeadingHappened
- ] = useState(false)
useEffect(() => {
- if (isScrollToCurrentHeadingHappened) {
- return
- }
- if (!document.location.hash) {
- setIsScrollToCurrentHeadingHappened(true)
- return
- }
- if (currentHeadingSlug) {
- setIsScrollToCurrentHeadingHappened(true)
- const currentHeadingSlugElem = document.getElementById(
- `link-${currentHeadingSlug}`
- )
+ if (currentHeadingSlug !== undefined) {
const contentBlockElem = contentBlockRef.current
- if (currentHeadingSlugElem && contentBlockElem) {
- const hasVerticalScrollbar =
- contentBlockElem.scrollHeight > contentBlockElem.clientHeight
- if (hasVerticalScrollbar) {
- currentHeadingSlugElem.scrollIntoView({
- block: 'start',
- inline: 'nearest'
+ if (contentBlockElem) {
+ if (currentHeadingSlug) {
+ const currentHeadingSlugElem = document.getElementById(
+ `link-${currentHeadingSlug}`
+ )
+ if (currentHeadingSlugElem) {
+ const hasVerticalScrollbar =
+ contentBlockElem.scrollHeight > contentBlockElem.clientHeight
+ if (hasVerticalScrollbar) {
+ contentBlockElem.scrollTo({
+ top:
+ currentHeadingSlugElem.offsetTop -
+ contentBlockElem.clientHeight +
+ currentHeadingSlugElem.clientHeight / 2,
+ behavior: 'smooth'
+ })
+ }
+ }
+ } else {
+ contentBlockElem.scrollTo({
+ top: 0
})
}
}
}
- })
+ }, [currentHeadingSlug])
return (
diff --git a/packages/gatsby-theme-iterative/src/components/Documentation/RightPanel/styles.module.css b/packages/gatsby-theme-iterative/src/components/Documentation/RightPanel/styles.module.css
index c68e5964..cde6a749 100644
--- a/packages/gatsby-theme-iterative/src/components/Documentation/RightPanel/styles.module.css
+++ b/packages/gatsby-theme-iterative/src/components/Documentation/RightPanel/styles.module.css
@@ -1,11 +1,8 @@
.container {
- position: sticky;
- top: var(--layout-header-height);
+ @apply mt-7 pt-14 sticky h-screen top-0;
flex-shrink: 0;
- box-sizing: border-box;
+
width: 170px;
- height: calc(100vh - 78px);
- padding-top: 57px;
font-size: 16px;
display: flex;
flex-direction: column;
@@ -16,8 +13,10 @@
}
.contentBlock {
+ @apply basis-36 grow min-h-[6rem];
+
overflow-y: scroll;
- margin-bottom: 27px;
+ margin-bottom: 17px;
&::-webkit-scrollbar {
appearance: none;
@@ -30,14 +29,11 @@
}
}
-.separator {
- border: none;
- border-top: 1px solid var(--color-lighter-blue);
-}
-
.header {
+ @apply h-14 pb-2 flex flex-col flex-nowrap justify-end;
font-size: 14px;
text-transform: uppercase;
+ border-bottom: 1px solid var(--color-lighter-blue);
color: var(--color-black);
}
@@ -63,6 +59,7 @@
}
.buttonsBlock {
+ margin-top: 10px;
margin-bottom: 20px;
flex-shrink: 0;
}
diff --git a/packages/gatsby-theme-iterative/src/components/Documentation/styles.module.css b/packages/gatsby-theme-iterative/src/components/Documentation/styles.module.css
index f4bb9eda..8086f3f6 100644
--- a/packages/gatsby-theme-iterative/src/components/Documentation/styles.module.css
+++ b/packages/gatsby-theme-iterative/src/components/Documentation/styles.module.css
@@ -1,7 +1,7 @@
.button {
position: relative;
z-index: 1;
- box-sizing: border-box;
+
display: inline-flex;
justify-content: center;
align-items: center;
diff --git a/packages/gatsby-theme-iterative/src/components/DocumentationLayout/index.tsx b/packages/gatsby-theme-iterative/src/components/DocumentationLayout/index.tsx
deleted file mode 100644
index 32bbb3cc..00000000
--- a/packages/gatsby-theme-iterative/src/components/DocumentationLayout/index.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import React from 'react'
-
-import MainLayout, { LayoutComponent, LayoutModifiers } from '../MainLayout'
-import ThemeDocumentationLayout from '../Documentation/Layout'
-
-const Layout: LayoutComponent = ({ children, ...restProps }) => {
- const {
- location: { pathname }
- } = restProps
-
- return (
-
-
- {children}
-
-
- )
-}
-
-export default Layout
diff --git a/packages/gatsby-theme-iterative/src/components/HamburgerIcon/index.tsx b/packages/gatsby-theme-iterative/src/components/HamburgerIcon/index.tsx
index caedcea2..714d50e5 100644
--- a/packages/gatsby-theme-iterative/src/components/HamburgerIcon/index.tsx
+++ b/packages/gatsby-theme-iterative/src/components/HamburgerIcon/index.tsx
@@ -8,7 +8,14 @@ interface IHamburgerProps {
}
const HamburgerIcon: React.FC
= ({ opened }) => (
-
+
diff --git a/packages/gatsby-theme-iterative/src/components/HamburgerIcon/styles.module.css b/packages/gatsby-theme-iterative/src/components/HamburgerIcon/styles.module.css
index 8e6e4f4a..c2d19157 100644
--- a/packages/gatsby-theme-iterative/src/components/HamburgerIcon/styles.module.css
+++ b/packages/gatsby-theme-iterative/src/components/HamburgerIcon/styles.module.css
@@ -1,7 +1,4 @@
.wrapper {
- display: inline-block;
- cursor: pointer;
-
&.opened {
transform: translateX(-4px);
}
diff --git a/packages/gatsby-theme-iterative/src/components/HamburgerMenu/styles.module.css b/packages/gatsby-theme-iterative/src/components/HamburgerMenu/styles.module.css
index 9ea59bd6..dce231c2 100644
--- a/packages/gatsby-theme-iterative/src/components/HamburgerMenu/styles.module.css
+++ b/packages/gatsby-theme-iterative/src/components/HamburgerMenu/styles.module.css
@@ -19,7 +19,7 @@
color: #fff;
overflow-y: auto;
- @media (--xs-scr) {
+ @media screen(xsMax) {
display: block;
}
@@ -34,15 +34,12 @@
}
.toggleButton {
- @mixin hover;
+ @apply hover px-2;
- position: fixed;
- display: none;
- visibility: hidden;
+ position: relative;
+ display: flex;
+ visibility: visible;
z-index: 999;
- right: 16px;
- top: 12px;
- padding: 0;
border: none;
width: 40px;
height: 40px;
@@ -58,16 +55,15 @@
}
&.opened {
+ position: absolute;
+ top: 1rem;
+ right: 0.5rem;
outline-color: #fff;
}
- &.expanded {
- top: 47px;
- }
-
- @media (--xs-scr) {
- display: flex;
- visibility: visible;
+ @media screen(xs) {
+ display: none;
+ visibility: hidden;
}
}
@@ -76,8 +72,8 @@
}
.logo {
- @mixin hover;
- @mixin active;
+ @apply hover;
+ @apply active;
width: 40px;
height: 40px;
@@ -91,8 +87,8 @@
}
.company {
- @mixin active;
- @mixin hover;
+ @apply active;
+ @apply hover;
font-size: 15px;
line-height: 20px;
@@ -145,9 +141,9 @@
}
a.sectionHeading {
- @mixin hover;
- @mixin active;
- @mixin focus;
+ @apply hover;
+ @apply active;
+ @apply focus;
}
.subSections {
@@ -174,8 +170,8 @@ a.sectionHeading {
}
.subSectionLink {
- @mixin hover;
- @mixin active;
+ @apply hover;
+ @apply active;
display: flex;
flex-direction: column;
@@ -206,7 +202,7 @@ a.sectionHeading {
}
.linkButton {
- @mixin active;
+ @apply active;
display: block;
margin-top: 15px;
diff --git a/packages/gatsby-theme-iterative/src/components/LayoutFooter/styles.module.css b/packages/gatsby-theme-iterative/src/components/LayoutFooter/styles.module.css
index 25815e58..0aae44fb 100644
--- a/packages/gatsby-theme-iterative/src/components/LayoutFooter/styles.module.css
+++ b/packages/gatsby-theme-iterative/src/components/LayoutFooter/styles.module.css
@@ -1,4 +1,5 @@
.wrapper {
+ @apply z-10;
width: 100%;
background-color: #40364d;
}
@@ -13,11 +14,11 @@
display: flex;
flex-wrap: wrap;
- @media (--md-scr) {
+ @media screen(mdMax) {
padding: 16px 32px;
}
- @media (--xs-scr) {
+ @media screen(xsMax) {
padding: 16px;
}
@@ -27,8 +28,8 @@
}
.logo {
- @mixin active;
- @mixin hover;
+ @apply active;
+ @apply hover;
display: block;
width: 40px;
@@ -36,7 +37,7 @@
margin-right: 150px;
margin-bottom: 18px;
- @media (--xs-scr) {
+ @media screen(xsMax) {
margin-bottom: 0;
}
@@ -54,12 +55,12 @@
display: flex;
flex-direction: row;
- @media (--md-scr) {
+ @media screen(mdMax) {
width: 100%;
flex-wrap: wrap;
}
- @media (--xs-scr) {
+ @media screen(xsMax) {
justify-content: space-between;
}
}
@@ -70,12 +71,12 @@
margin-top: 3px;
margin-right: 86px;
- @media (--md-scr) {
+ @media screen(mdMax) {
margin-right: 36px;
margin-top: 0;
}
- @media (--xs-scr) {
+ @media screen(xsMax) {
margin-top: 26px;
margin-right: 0;
width: calc(50% - 12px);
@@ -114,8 +115,8 @@
}
.link {
- @mixin active;
- @mixin focus;
+ @apply active;
+ @apply focus;
display: flex;
align-items: center;
@@ -126,7 +127,7 @@
letter-spacing: 0.02em;
padding: 4px 0;
- @media (--md-scr) {
+ @media screen(mdMax) {
font-size: 16px;
line-height: 28px;
}
@@ -142,7 +143,7 @@
width: 24px;
height: 24px;
- @media (--md-scr) {
+ @media screen(mdMax) {
margin-right: 10px;
}
}
@@ -153,7 +154,7 @@
width: 20px;
height: 20px;
- @media (--md-scr) {
+ @media screen(mdMax) {
margin-right: 10px;
width: 18px;
height: 18px;
@@ -166,7 +167,7 @@
justify-content: space-between;
margin-top: 24px;
- @media (--sm-scr) {
+ @media screen(smMax) {
flex-direction: column;
align-items: center;
text-align: center;
@@ -184,7 +185,7 @@
}
.companyDescription {
- @media (--xs-scr) {
+ @media screen(xsMax) {
font-size: 14px;
line-height: 16px;
width: 100%;
@@ -192,8 +193,8 @@
}
.companyName {
- @mixin active;
- @mixin hover;
+ @apply active;
+ @apply hover;
font-weight: 800;
font-size: inherit;
@@ -228,11 +229,11 @@
.socialIcons {
display: flex;
- @media (--sm-scr) {
+ @media screen(smMax) {
margin-top: 12px;
}
- @media (--xxs-scr) {
+ @media screen(xxsMax) {
width: 100%;
justify-content: space-between;
}
@@ -241,18 +242,17 @@
.socialIcon {
width: 26px;
height: 26px;
- padding: 11px;
margin-right: 24px;
- @media (--md-scr) {
+ @media screen(mdMax) {
margin-right: 8px;
}
- @media (--sm-scr) {
+ @media screen(smMax) {
margin-right: 24px;
}
- @media (--xxs-scr) {
+ @media screen(xxsMax) {
margin-right: 0;
}
diff --git a/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/data.ts b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/data.ts
new file mode 100644
index 00000000..4c7cd752
--- /dev/null
+++ b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/data.ts
@@ -0,0 +1,18 @@
+import { getFirstPage } from '../../../../utils/shared/sidebar'
+import { INavLinkData, INavLinkPopupData } from './types'
+
+const docsPage = getFirstPage()
+
+const navLinkItemsData: Array
= [
+ {
+ href: docsPage,
+ eventType: 'doc',
+ text: 'Doc'
+ },
+ {
+ text: 'Other Tools',
+ popup: 'OtherToolsPopup'
+ }
+]
+
+export default navLinkItemsData
diff --git a/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/getShowOnClass.ts b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/getShowOnClass.ts
new file mode 100644
index 00000000..dc8c025f
--- /dev/null
+++ b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/getShowOnClass.ts
@@ -0,0 +1,13 @@
+import cn from 'classnames'
+
+const showOnClasses = {
+ xs: 'xs:block',
+ sm: 'sm:block',
+ md: 'md:block',
+ lg: 'lg:block'
+}
+
+export type ScreenSize = keyof typeof showOnClasses
+
+export const getShowOnClass = (size: ScreenSize | undefined): string =>
+ size ? cn('hidden', showOnClasses[size]) : 'block'
diff --git a/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/index.tsx b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/index.tsx
index 0455c3a2..6679cb19 100644
--- a/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/index.tsx
+++ b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/index.tsx
@@ -8,40 +8,12 @@ import { ReactComponent as ArrowUpSVG } from '../../../../images/arrow-up-icon.s
import { ReactComponent as ArrowDownSVG } from '../../../../images/arrow-down-icon.svg'
import { logEvent } from '../../../../utils/front/plausible'
-import { getFirstPage } from '../../../../utils/shared/sidebar'
-
-const docsPage = getFirstPage()
import * as styles from './styles.module.css'
+import { INavLinkData, INavLinkPopupData } from './types'
-type PopupName = 'CommunityPopup' | 'OtherToolsPopup'
-
-interface INavLinkData {
- href: string
- eventType: string
- text: string
-}
-
-interface INavLinkPopupData {
- text: string
- popup: PopupName
-}
-
-const navLinkItemsData: Array = [
- {
- href: docsPage,
- eventType: 'doc',
- text: 'Doc'
- },
- {
- text: 'Other Tools',
- popup: 'OtherToolsPopup'
- }
-]
-
-const isPopup = (
- item: INavLinkData | INavLinkPopupData
-): item is INavLinkPopupData => (item as INavLinkPopupData).popup !== undefined
+import navLinkItemsData from './data'
+import { getShowOnClass } from './getShowOnClass'
const LinkItems: React.FC = ({}) => {
const [isCommunityPopupOpen, setIsCommunityPopupOpen] = useState(false)
@@ -118,66 +90,68 @@ const LinkItems: React.FC = ({}) => {
}
}
- return (
-
- {navLinkItemsData.map((item, i) => (
- - (
+
-
+ logEvent('Nav', { Item: eventType })}
+ href={href}
+ className={styles.link}
+ >
+ {text}
+
+
+ )
+ const PopupItem = ({ popup, showOn, text }: INavLinkPopupData) => (
+ -
+ <>
+
- ))}
+ >
+ {text}
+
+
+
+ {popup === 'OtherToolsPopup' ? (
+
+ ) : (
+
+ )}
+ >
+
+ )
+
+ return (
+
+ {navLinkItemsData.map((item, i) =>
+ (item as INavLinkPopupData).popup === undefined ? (
+
+ ) : (
+
+ )
+ )}
)
}
diff --git a/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/styles.module.css b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/styles.module.css
index 68216660..1529bca3 100644
--- a/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/styles.module.css
+++ b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/styles.module.css
@@ -7,36 +7,10 @@
padding: 0;
}
-.linkItem {
- position: relative;
- margin-left: 12px;
-
- &:first-of-type {
- margin: 0;
- }
-
- @media (--md-scr) {
- margin-left: 0;
-
- &:first-child {
- display: none;
- }
- }
-
- @media (--sm-scr) {
- margin-left: 4px;
-
- &:nth-child(5),
- &:nth-child(4) {
- display: none;
- }
- }
-}
-
.link {
- @mixin active;
- @mixin hover;
- @mixin focus;
+ @apply active;
+ @apply hover;
+ @apply focus;
font-family: var(--font-base);
font-weight: 400;
@@ -76,7 +50,7 @@
display: none;
}
- @media (--md-scr) {
+ @media screen(mdMax) {
font-size: 17px;
line-height: 20px;
diff --git a/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/types.ts b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/types.ts
new file mode 100644
index 00000000..6e360e9c
--- /dev/null
+++ b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/LinkItems/types.ts
@@ -0,0 +1,17 @@
+import { ScreenSize } from './getShowOnClass'
+
+export type PopupName = 'CommunityPopup' | 'OtherToolsPopup'
+
+interface INavLinkCommonData {
+ showOn?: ScreenSize
+ text: string
+}
+
+export interface INavLinkData extends INavLinkCommonData {
+ href: string
+ eventType: string
+}
+
+export interface INavLinkPopupData extends INavLinkCommonData {
+ popup: PopupName
+}
diff --git a/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/Popup/styles.module.css b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/Popup/styles.module.css
index 8ee122dd..e0ab81f6 100644
--- a/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/Popup/styles.module.css
+++ b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/Popup/styles.module.css
@@ -1,20 +1,21 @@
.popup {
- display: grid;
+ display: none;
+ visibility: hidden;
padding: 8px;
opacity: 0;
position: absolute;
left: 10px;
top: calc(100% + 4px);
- visibility: hidden;
z-index: 2;
background-color: #fff;
filter: drop-shadow(0 2px 8px rgb(0 0 0 / 15%));
border-radius: 12px;
- box-sizing: border-box;
+
transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
&.visible {
opacity: 1;
+ display: grid;
visibility: visible;
}
}
diff --git a/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/SocialIcons/styles.module.css b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/SocialIcons/styles.module.css
index cb93b0cb..8c016323 100644
--- a/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/SocialIcons/styles.module.css
+++ b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/SocialIcons/styles.module.css
@@ -1,38 +1,19 @@
.socialIcons {
flex-direction: row;
display: flex;
- padding: 0;
- margin: 0 16px 0 4px;
-
- @media (--xl-scr) {
- margin: 0 24px 0 12px;
- }
-
- @media (--md-scr) {
- margin: 0 16px 0 0;
- }
-
- @media (--sm-scr) {
- margin: 0 16px 0 4px;
- }
}
.socialIcon {
+ @apply p-1;
display: block;
- width: 24px;
- height: 24px;
color: #6f7685;
- padding: 12px;
- margin: 0;
-
- @media (--md-scr) {
- width: 20px;
- height: 20px;
- padding: 6px;
- }
-
svg {
- width: inherit;
- height: inherit;
+ @apply w-5 h-5;
+ @media screen(md) {
+ @apply w-6 h-6;
+ }
+ @media screen(lg) {
+ @apply w-7 h-7;
+ }
}
}
diff --git a/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/styles.module.css b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/styles.module.css
index 9cbc789e..696142a9 100644
--- a/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/styles.module.css
+++ b/packages/gatsby-theme-iterative/src/components/LayoutHeader/Nav/styles.module.css
@@ -1,5 +1,5 @@
.wrapper {
- display: flex;
+ @apply hidden;
flex-shrink: 0;
flex-direction: row;
align-items: center;
@@ -8,12 +8,13 @@
list-style-type: none;
}
- @media (--xs-scr) {
- display: none;
+ @media screen(xs) {
+ @apply flex;
}
}
.getStartedButton {
+ @apply mx-2;
position: relative;
border-radius: 100px;
z-index: 1;
@@ -47,7 +48,7 @@
opacity: 1;
}
- @media (--md-scr) {
+ @media screen(mdMax) {
padding: 12px 24px;
font-size: 14px;
}
diff --git a/packages/gatsby-theme-iterative/src/components/LayoutHeader/alert.tsx b/packages/gatsby-theme-iterative/src/components/LayoutHeader/alert.tsx
index 3e1e1994..d58718a8 100644
--- a/packages/gatsby-theme-iterative/src/components/LayoutHeader/alert.tsx
+++ b/packages/gatsby-theme-iterative/src/components/LayoutHeader/alert.tsx
@@ -8,7 +8,15 @@ import * as styles from './styles.module.css'
const LayoutAlert: React.FC<{ collapsed: boolean }> | false = ({
collapsed
}) => (
-
+
🚀
{' '}
diff --git a/packages/gatsby-theme-iterative/src/components/LayoutHeader/index.tsx b/packages/gatsby-theme-iterative/src/components/LayoutHeader/index.tsx
index 95d052b7..d74cbef9 100644
--- a/packages/gatsby-theme-iterative/src/components/LayoutHeader/index.tsx
+++ b/packages/gatsby-theme-iterative/src/components/LayoutHeader/index.tsx
@@ -12,67 +12,73 @@ import {
useHamburgerMenu
} from '../HamburgerMenu'
-import { useHeaderIsScrolled } from '../../utils/front/scroll'
import { ReactComponent as LogoSVG } from '../../images/dvc_icon-color--square_vector.svg'
import * as styles from './styles.module.css'
import LayoutAlert from './alert'
+import { useInView } from 'react-intersection-observer'
+
+const LayoutHeader: React.FC = ({ modifiers }) => {
+ const { ref, inView } = useInView({ rootMargin: '20px 0px 0px 0px' })
+ const scrolled = !inView
-const LayoutHeader: React.FC> = ({ modifiers }) => {
const { opened, handleToggle, handleItemClick } = useHamburgerMenu()
- const scrolled = useHeaderIsScrolled()
const hasCollapsedModifier = includes(modifiers, LayoutModifiers.Collapsed)
const hasHideAlertModifier = includes(modifiers, LayoutModifiers.HideAlert)
const collapsed = opened || hasCollapsedModifier || scrolled
return (
<>
-