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

style(site): add changes to tabs components #45

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions packages/site/gatsby-ssr.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@
import LayoutComponent from './wrapPageElement';

export const wrapPageElement = LayoutComponent;

const HtmlAttributes = {
lang: 'en',
};

export const onRenderBody = ({ setHtmlAttributes }) => {
setHtmlAttributes(HtmlAttributes);
};
5 changes: 4 additions & 1 deletion packages/site/src/components/AppLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ const AppLayout = ({ children }: { children: ReactNode }) => {
>
{/* overlay */}
{open && (
<div onClick={onOpen} className="absolute lg:hidden inset-0 h-full min-h-screen bg-white/70 z-[1000]"></div>
<div
onClick={onOpen}
className="absolute lg:hidden inset-0 h-full min-h-screen bg-white/70 dark:bg-dark/90 z-[1000]"
></div>
)}
<section className="px-4 md:px-6 xl:px-19">
<AppHeader onOpen={onOpen} />
Expand Down
11 changes: 7 additions & 4 deletions packages/site/src/components/AppTabs/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Children, JSXElementConstructor, ReactElement, ReactNode, useState } from 'react';
import React, { Children, FunctionComponentElement, ReactNode, useState } from 'react';

type AppTabProps = {
isActive?: boolean;
Expand All @@ -9,7 +9,7 @@ type AppTabProps = {
};

type Props = {
children: Array<ReactElement<AppTabProps, JSXElementConstructor<unknown>>>;
children: Array<FunctionComponentElement<AppTabProps>>;
};

export const AppTab = ({ isActive, position, ariaLabelledby, children }: AppTabProps) => {
Expand All @@ -26,12 +26,15 @@ export const AppTab = ({ isActive, position, ariaLabelledby, children }: AppTabP
);
};

AppTab.displayName = 'AppTab';

const AppTabs = ({ children }: Props) => {
const [activeIndex, setActiveIndex] = useState(0);

const nodes = Children.map(children, (node) => {
if (node.type.name !== 'AppTab') {
throw new Error('Use AppTab within AppTabs');
console.log(node.type.name);
if (node.type.displayName !== 'AppTab') {
console.warn('Use AppTab within AppTabs');
}
return node;
});
Expand Down
4 changes: 2 additions & 2 deletions packages/site/src/docs/demo.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Gatsby Source
tail: Hubspot Node Plugin v1.0.1
tail: Hubspot Node Demo
slug: demo
date: 2019-01-29
tableOfContentsDepth: 2
Expand All @@ -12,7 +12,7 @@ import AppCardWithPhoto from '@components/AppCard/AppCardWithPhoto';
import AppCardWithContact from '@components/AppCard/AppCardWithContact';

Examples using Github repo data
<AppCard className="p-4 mb-10 bg-white dark:bg-gray-80 shadow">
<AppCard className="p-4 mb-10 bg-white dark:bg-gray-80 shadow-inner lg:shadow">
<ul className="grid grid-cols-2 md:grid-cols-3 xl:grid-cols-5 place-content-between md:place-items-center bg-brand-dgray dark:bg-dark shadow-sm rounded-md px-6 py-4 gap-4">
<li className="flex justify-center md:justify-normal basis-full md:basis-auto">
<div className="text-center">
Expand Down
4 changes: 2 additions & 2 deletions packages/site/src/docs/development.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ The rest of this part of the Tutorial walks you through how to install the follo

Follow the installation instructions below, based on your computer's operating system. (Click the header to expand the section.)

<iframe
{/* <iframe
width="100%"
height="415"
src="https://codesandbox.io/p/sandbox/quirky-fire-x8h7j6?file=%2Fsrc%2Findex.js"
title="YouTube video player"
frameBorder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
></iframe>
></iframe> */}
{/* <Collapsible
summary={<h4>Mac instructions</h4>}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/site/src/pages/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default DashboardPage;
export const Head: HeadFC = () => (
<>
<html lang="en" />
<title>Dashboard Page</title>
<title>Demo Page</title>
<meta name="author" content="Samson Iyanda"></meta>
<meta name="description" content="site for gatsby source hubspot plugin documentation"></meta>
<meta name="keywords" content="gatsby, gatsby plugin, reactjs, hubspot"></meta>
Expand Down
3 changes: 3 additions & 0 deletions packages/site/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export const query = graphql`
export const Head: HeadFC<Queries.IndexPageQuery> = ({ data }) => (
<>
<title>{data.mdx.frontmatter.title}</title>
<meta name="author" content="Samson Iyanda"></meta>
<meta name="description" content="site for gatsby source hubspot plugin documentation"></meta>
<meta name="keywords" content="gatsby, gatsby plugin, reactjs, hubspot"></meta>
</>
);

Expand Down
15 changes: 14 additions & 1 deletion packages/site/src/templates/docs.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import type { PageProps } from 'gatsby';
import type { HeadFC, PageProps } from 'gatsby';

import { Props as TableContentProps } from '@components/AppTableOfContents';
import ContentMarkUp from '@components/ContentMarkUp';
Expand All @@ -19,4 +19,17 @@ const DocMarkUp: React.FC<PageProps<unknown, Queries.GetAllDocumentsQuery['allMd
);
};

export const Head: HeadFC<unknown, Queries.GetAllDocumentsQuery['allMdx']['nodes'][0]> = (data) => {
const { title, tail, summary } = data.pageContext.frontmatter;
return (
<>
<title>
{title} {tail ? tail : ''}
</title>
<meta name="author" content="Samson Iyanda"></meta>
<meta name="description" content={summary}></meta>
</>
);
};

export default DocMarkUp;
Loading