Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jordisala1991 committed Jun 4, 2024
1 parent d2946a8 commit 86e182f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions ui-src/components/ExportForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { Button } from '@create-figma-plugin/ui';
import { FormProvider, useForm } from 'react-hook-form';

import { Stack } from '@ui/components/Stack';
import { useFigma } from '@ui/context';
import { useFigmaContext } from '@ui/context';

import { MissingFontsSection } from './MissingFontsSection';

export type FormValues = Record<string, string>;

export const ExportForm = () => {
const { cancel, exportPenpot } = useFigma();
const { cancel, exportPenpot } = useFigmaContext();
const methods = useForm<FormValues>();

return (
Expand Down
4 changes: 2 additions & 2 deletions ui-src/components/ExporterProgress.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { LoadingIndicator } from '@create-figma-plugin/ui';

import { useFigma } from '@ui/context';
import { useFigmaContext } from '@ui/context';

import { Stack } from './Stack';

export const ExporterProgress = () => {
const { currentNode, totalPages, processedPages, downloading } = useFigma();
const { currentNode, totalPages, processedPages, downloading } = useFigmaContext();

const truncateText = (text: string, maxChars: number) => {
if (text.length <= maxChars) {
Expand Down
4 changes: 2 additions & 2 deletions ui-src/components/MissingFontsSection.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Banner, IconInfo32, Link, Textbox } from '@create-figma-plugin/ui';
import { Controller, useFormContext } from 'react-hook-form';

import { useFigma } from '@ui/context';
import { useFigmaContext } from '@ui/context';

import { Stack } from './Stack';

export const MissingFontsSection = () => {
const { missingFonts } = useFigma();
const { missingFonts } = useFigmaContext();

if (!missingFonts || !missingFonts.length) return null;

Expand Down
4 changes: 2 additions & 2 deletions ui-src/components/PenpotExporter.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { LoadingIndicator } from '@create-figma-plugin/ui';

import { useFigma } from '@ui/context';
import { useFigmaContext } from '@ui/context';

import { ExportForm } from './ExportForm';
import { ExporterProgress } from './ExporterProgress';
import { PluginReload } from './PluginReload';

export const PenpotExporter = () => {
const { loading, needsReload, exporting } = useFigma();
const { loading, needsReload, exporting } = useFigmaContext();

if (loading) return <LoadingIndicator />;

Expand Down
4 changes: 2 additions & 2 deletions ui-src/components/PluginReload.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Banner, Button, IconInfo32 } from '@create-figma-plugin/ui';

import { Stack } from '@ui/components/Stack';
import { useFigma } from '@ui/context';
import { useFigmaContext } from '@ui/context';

export const PluginReload = () => {
const { reload, cancel } = useFigma();
const { reload, cancel } = useFigmaContext();

return (
<Stack space="small">
Expand Down
4 changes: 1 addition & 3 deletions ui-src/context/useFigma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type ProgressProcessedPages = {
data: number;
};

const useFigma = (): UseFigmaHook => {
export const useFigma = (): UseFigmaHook => {
const [missingFonts, setMissingFonts] = useState<string[]>();
const [needsReload, setNeedsReload] = useState(false);
const [loading, setLoading] = useState(true);
Expand Down Expand Up @@ -143,5 +143,3 @@ const useFigma = (): UseFigmaHook => {
exportPenpot
};
};

export { useFigma };

0 comments on commit 86e182f

Please sign in to comment.