-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Title): add title font customization
- Loading branch information
Showing
5 changed files
with
90 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {FontParams, PluginTitleSize} from './types'; | ||
|
||
export const PLUGIN_ROOT_ATTR_NAME = 'data-plugin-root-el'; | ||
|
||
export const TITLE_DEFAULT_SIZES: Record<PluginTitleSize, FontParams> = { | ||
xl: { | ||
fontSize: 32, | ||
lineHeight: 40, | ||
}, | ||
|
||
l: { | ||
fontSize: 24, | ||
lineHeight: 28, | ||
}, | ||
|
||
m: { | ||
fontSize: 20, | ||
lineHeight: 24, | ||
}, | ||
|
||
s: { | ||
fontSize: 17, | ||
lineHeight: 24, | ||
}, | ||
|
||
xs: { | ||
fontSize: 15, | ||
lineHeight: 20, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
export * from './Title'; | ||
export {default as pluginTitle} from './Title'; | ||
export * from './types'; | ||
export * from './constants'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export type PluginTitleSize = 'xl' | 'l' | 'm' | 's' | 'xs'; | ||
|
||
export interface FontParams { | ||
fontSize: number; | ||
lineHeight: number; | ||
} | ||
|
||
interface FontSizeProps { | ||
size: PluginTitleSize; | ||
} | ||
|
||
type UndefinedProps<T extends Object> = Partial<Record<keyof T, undefined>>; | ||
|
||
export type FontDataProps = | ||
| (FontSizeProps & UndefinedProps<FontParams>) | ||
| (UndefinedProps<FontSizeProps> & FontParams); |