-
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 (#241)
* feat(Title): add title font customization * feat(Title): mark fields as optional * feat(Title): add story for font-size only prop * feat(Title): add default story with data args * chore(Title): rename constant * feat(Title): custom font params with relative lineHeight * fix(Title): move constant and add check on fontSize presense
- Loading branch information
Showing
6 changed files
with
190 additions
and
17 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,26 @@ | ||
import {PluginTitleSize, TitleFontParams} from './types'; | ||
|
||
export const TITLE_DEFAULT_SIZES: Record<PluginTitleSize, TitleFontParams> = { | ||
xl: { | ||
fontSize: '32px', | ||
lineHeight: '40px', | ||
}, | ||
l: { | ||
fontSize: '24px', | ||
lineHeight: '28px', | ||
}, | ||
m: { | ||
fontSize: '20px', | ||
lineHeight: '24px', | ||
}, | ||
s: { | ||
fontSize: '17px', | ||
lineHeight: '24px', | ||
}, | ||
xs: { | ||
fontSize: '15px', | ||
lineHeight: '20px', | ||
}, | ||
}; | ||
|
||
export const RECCOMMENDED_LINE_HEIGHT_MULTIPLIER = 1.25; |
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 {PluginTitleSize, TitleFontParams} from './types'; | ||
export {TITLE_DEFAULT_SIZES} 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,6 @@ | ||
export type PluginTitleSize = 'xl' | 'l' | 'm' | 's' | 'xs'; | ||
|
||
export interface TitleFontParams { | ||
fontSize: string; | ||
lineHeight?: string; | ||
} |
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,5 @@ | ||
import type {PluginTitleSize, TitleFontParams} from './types'; | ||
|
||
export function isCustomSize(size: PluginTitleSize | TitleFontParams): size is TitleFontParams { | ||
return typeof size === 'object'; | ||
} |