Skip to content

Commit

Permalink
fix: letter spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
vshakitskiy committed Dec 27, 2023
1 parent 2d43f0a commit 4edc464
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/dashboard/src/components/EditorToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function EditorToolbar() {
fontFamily: 'Inter',
fontWeight: 400,
lineHeight: 1,
letterSpacing: 0,
fontSize: 50,
align: 'left',
}}>
Expand Down Expand Up @@ -99,6 +100,7 @@ export function EditorToolbar() {
fontFamily: 'Inter',
fontWeight: 400,
lineHeight: 1,
letterSpacing: 0,
fontSize: 50,
align: 'left',
}}>
Expand Down
7 changes: 6 additions & 1 deletion apps/dashboard/src/components/RightPanel/FontSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ export function FontSection({ selectedElement }: FontSectionProps) {
}} type="number" value={selectedElement.lineHeight}>
<LineHeightIcon />
</Input>
<Input max={5} min={0} onChange={() => { updateElement(selectedElement); }} type="number" value={0}>
<Input max={5} min={0} onChange={value => {
updateElement({
...selectedElement,
letterSpacing: value,
});
}} type="number" value={selectedElement.letterSpacing}>
<LetterSpacingIcon />
</Input>
<Select onChange={value => {
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/src/lib/elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export function createElementStyle(element: OGElement): CSSProperties {
fontWeight: element.fontWeight,
fontSize: `${element.fontSize}px`,
lineHeight: element.lineHeight,
letterSpacing: `${element.letterSpacing}px`,
textAlign: element.align,
// By default, Satori sets a margin top and bottom on some elements:
// https://github.com/vercel/satori/blob/29fe2e4a9676a1ba41c361ec1a547d6de329b039/src/handler/presets.ts#L15
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export interface OGPElement {
fontWeight: number
fontSize: number
lineHeight: number
letterSpacing: number
align: 'left' | 'center' | 'right'
}

Expand Down

0 comments on commit 4edc464

Please sign in to comment.