Skip to content

Commit

Permalink
Merge pull request #86 from dtran421/fix_storybook
Browse files Browse the repository at this point in the history
Fix chromatic
  • Loading branch information
dtran421 authored Feb 23, 2024
2 parents d09d36e + 4bc2e42 commit 1f0b7e8
Show file tree
Hide file tree
Showing 17 changed files with 121 additions and 124 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ jobs:
max-annotations: 10
fail-on-error: true

#- name: Publish to Chromatic
# uses: chromaui/action@v1
# with:
# projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
- name: Publish to Chromatic
uses: chromaui/action@v1
with:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}

preview:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@typescript-eslint/parser": "^5.23.0",
"@vitest/coverage-v8": "^0.34.1",
"autoprefixer": "^10.4.2",
"chromatic": "^6.20.0",
"chromatic": "^11.0.0",
"cypress": "^12.17.4",
"dotenv": "^16.3.1",
"eslint": "^8.15.0",
Expand Down
8 changes: 4 additions & 4 deletions src/app/api/alphavantage/[fn]/[ticker]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Option } from "utils-toolkit";
import { logger } from "@/utils/ServerUtil";
import { AlphavantageFn } from "@/utils/types";

type CompanyQR = {
interface CompanyQR {
Name: string;
Exchange: string;
Sector: string;
Expand All @@ -15,16 +15,16 @@ type CompanyQR = {
EPS: string;
"52WeekHigh": string;
"52WeekLow": string;
};
}

type QuoteQR = {
interface QuoteQR {
"Global Quote": {
"05. price": string;
"07. latest trading day": string;
"09. change": string;
"10. change percent": string;
};
};
}

/**
* Get base Alphavantage url
Expand Down
10 changes: 5 additions & 5 deletions src/app/blog/[slug]/blog-post-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import Body from "@/components/BlogPost/Body";
import FetchError from "@/components/Global/FetchError";
import { BlogPost } from "@/utils/types";

type ProfileHeaderProps = {
interface ProfileHeaderProps {
publishDate: string;
inspectorProps: ReturnType<
typeof useContentfulInspectorMode<{
entryId: string;
}>
>;
};
}

const ProfileHeader = ({ publishDate, inspectorProps }: ProfileHeaderProps) => (
<div className="flex flex-col md:flex-row justify-between items-start md:items-center text-slate-700 dark:text-slate-300 space-y-2 md:space-y-0">
Expand Down Expand Up @@ -49,9 +49,9 @@ const ProfileHeader = ({ publishDate, inspectorProps }: ProfileHeaderProps) => (
</div>
);

type BlogPostProps = {
interface BlogPostProps {
blogPost: BlogPost;
};
}

const BlogPostPage = ({ blogPost }: BlogPostProps) => {
const inspectorProps = useContentfulInspectorMode({ entryId: blogPost.sys.id });
Expand Down Expand Up @@ -110,7 +110,7 @@ const BlogPostPage = ({ blogPost }: BlogPostProps) => {
))}
</div>
</div>
<Body document={body.json} links={body?.links} />
<Body document={body?.json} links={body?.links} />
</div>
</main>
);
Expand Down
4 changes: 2 additions & 2 deletions src/app/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { logger } from "@/utils/ServerUtil";
import BlogPostPage from "./blog-post-page";
import { getBlogPost } from "./query";

type Props = {
interface Props {
params: { slug: string };
};
}

export async function generateMetadata({ params }: Props): Promise<Metadata> {
// read route params
Expand Down
4 changes: 2 additions & 2 deletions src/app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { queryContentful } from "@/utils/Contentful";
import { logger } from "@/utils/ServerUtil";
import { BlogPost } from "@/utils/types";

type BlogQR = {
interface BlogQR {
blogPosts: BlogPost[];
};
}

export const revalidate = 3600; // revalidate the data at most every hour

Expand Down
6 changes: 3 additions & 3 deletions src/app/main-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import { ThemeContext } from "@/contexts/theme-context";

const queryClient = new QueryClient();

type MainLayoutProps = {
interface Props {
debug: boolean;
children: ReactNode;
};
}

const MainLayout = ({ debug, children }: MainLayoutProps) => {
const MainLayout = ({ debug, children }: Props) => {
const { darkMode } = useContext(ThemeContext);

return (
Expand Down
4 changes: 2 additions & 2 deletions src/app/portfolio/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export const metadata: Metadata = {
openGraph,
};

type PortfolioQR = {
interface PortfolioQR {
timelineEvents: TimelineEvent[];
languageGroups: LanguageGroup[];
};
}

export const revalidate = 3600; // revalidate the data at most every hour

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ const SplashScreen = (segment: string) => {
}
};

type AppDemoLayoutProps = {
interface Props {
children: ReactNode;
};
}

const AppDemoLayout = ({ children }: AppDemoLayoutProps) => {
const AppDemoLayout = ({ children }: Props) => {
const segment = useSelectedLayoutSegment() as string;

const paragraphs = getParagraphs(segment);
Expand Down
6 changes: 3 additions & 3 deletions src/app/projects/(project-pages)/(finance)/finance-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ const getClassProfileData = (segment: string | null) => {
}
};

type FinanceLayoutProps = {
interface Props {
children: ReactNode;
};
}

const FinanceLayout = ({ children }: FinanceLayoutProps) => {
const FinanceLayout = ({ children }: Props) => {
const segment = useSelectedLayoutSegment();

const { symbol, purchasePrice } = getStockData(segment);
Expand Down
6 changes: 3 additions & 3 deletions src/app/projects/(project-pages)/(repo)/repo-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ const getRepoData = (segment: string | null) => {
}
};

type RepoPageProps = {
interface Props {
children: ReactNode;
};
}

const RepoLayout = ({ children }: RepoPageProps) => {
const RepoLayout = ({ children }: Props) => {
const segment = useSelectedLayoutSegment();
const { accentColor } = useProjectData(segment) || { accentColor: "#fff" };

Expand Down
6 changes: 3 additions & 3 deletions src/app/projects/(project-pages)/projects-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import ProjectsBackButton from "@/components/Projects/ProjectsBackButton";
import ProjectsBanner from "@/components/Projects/ProjectsBanner";
import { useProjectData } from "@/hooks/useProjectData";

type ProjectLayoutProps = {
interface Props {
children: ReactNode;
};
}

const ProjectLayout = ({ children }: ProjectLayoutProps) => {
const ProjectLayout = ({ children }: Props) => {
const segment = useSelectedLayoutSegments().at(-1);
const projectData = useProjectData(segment);

Expand Down
4 changes: 2 additions & 2 deletions src/components/Blog/BlogPostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { cn } from "utils-toolkit";
import useEstimateReadingTime from "@/hooks/useEstimateReadingTime";
import { BlogPost } from "@/utils/types";

type TagsProps = {
interface TagsProps {
tags: string[];
};
}

const Tags = ({ tags }: TagsProps) => (
<div className="flex flex-wrap gap-2">
Expand Down
10 changes: 5 additions & 5 deletions src/components/BlogPost/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { Document } from "@contentful/rich-text-types";
import useRichTextRenderOptions from "@/hooks/useRichTextRenderOptions";
import { Links } from "@/utils/types";

type BodyProps = {
document: Document | undefined;
links: Links | undefined;
};
interface Props {
document?: Document;
links?: Links;
}

const Body = ({ document, links }: BodyProps) => {
const Body = ({ document, links }: Props) => {
const { renderOptions } = useRichTextRenderOptions(links);

if (!document) {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Global/Emoji.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
type EmojiProps = {
interface Props {
label: string;
symbol: string;
className?: string;
};
}

const Emoji = ({ label, symbol, className }: EmojiProps) => (
const Emoji = ({ label, symbol, className }: Props) => (
<span className={className || ""} role="img" aria-label={label || ""} aria-hidden={label ? "false" : "true"}>
{symbol}
</span>
Expand Down
14 changes: 13 additions & 1 deletion src/components/Portfolio/LearnMore.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,17 @@ export default meta;
type Story = StoryObj<typeof LearnMore>;

export const Primary: Story = {
render: () => <LearnMore />,
render: () => (
<div className="h-screen flex flex-col justify-end pb-10">
<LearnMore />
</div>
),
};

export const Hidden: Story = {
render: () => (
<div className="h-screen flex flex-col justify-center pb-10">
<LearnMore />
</div>
),
};
Loading

0 comments on commit 1f0b7e8

Please sign in to comment.