mirror of
https://github.com/penpot/penpot-exporter-figma-plugin.git
synced 2024-12-22 21:53:27 -05:00
c013e80962
* wip * moved logic to validate custom fonts * missing fonts section * lint * refactor and improve * simplify resize * refactor * Implemente custom fonts * styling plugin * styling plugin * minor styling fix * changeset * fix * fix eslint --------- Co-authored-by: Jordi Sala Morales <jordism91@gmail.com>
34 lines
997 B
TypeScript
34 lines
997 B
TypeScript
import { useFormContext } from 'react-hook-form';
|
|
|
|
type MissingFontsSectionProps = {
|
|
fonts?: string[];
|
|
};
|
|
|
|
export const MissingFontsSection = ({ fonts }: MissingFontsSectionProps) => {
|
|
const { register } = useFormContext();
|
|
|
|
if (fonts === undefined || !fonts.length) return;
|
|
|
|
return (
|
|
<section className="missing-fonts-section">
|
|
<div className="missing-fonts-header">
|
|
{fonts.length} missing font{fonts.length > 1 ? 's' : ''}:{' '}
|
|
</div>
|
|
<small className="font-install-message">
|
|
Ensure fonts are installed in Penpot before exporting.
|
|
</small>
|
|
<div className="missing-fonts-list">
|
|
{fonts.map(font => (
|
|
<div key={font} className="font-input-row">
|
|
<span className="font-name">{font}</span>
|
|
<input
|
|
className="font-id-input"
|
|
placeholder="Enter Penpot font id"
|
|
{...register(font)}
|
|
/>
|
|
</div>
|
|
))}
|
|
</div>
|
|
</section>
|
|
);
|
|
};
|