diff --git a/example/android/app/src/main/assets/fonts/ReadexPro-SemiBold.ttf b/example/android/app/src/main/assets/fonts/ReadexPro-SemiBold.ttf new file mode 100644 index 00000000..5ca73122 Binary files /dev/null and b/example/android/app/src/main/assets/fonts/ReadexPro-SemiBold.ttf differ diff --git a/example/android/link-assets-manifest.json b/example/android/link-assets-manifest.json index 88ef8333..cdfdefbc 100644 --- a/example/android/link-assets-manifest.json +++ b/example/android/link-assets-manifest.json @@ -101,6 +101,10 @@ "path": "assets/fonts/ReadexPro/ReadexPro-Regular.ttf", "sha1": "93e4080794b725f216a94b57ed62a51bc77bce91" }, + { + "path": "assets/fonts/ReadexPro/ReadexPro-SemiBold.ttf", + "sha1": "b4ec28a6b1ba6ed730beb37f06b1b81c5e2163a3" + }, { "path": "assets/fonts/DMMono/DMMono-Medium.ttf", "sha1": "0ceec76262c08cec6c956e1ffe2bfc60321e8f58" diff --git a/example/assets/fonts/ReadexPro/ReadexPro-SemiBold.ttf b/example/assets/fonts/ReadexPro/ReadexPro-SemiBold.ttf new file mode 100644 index 00000000..5ca73122 Binary files /dev/null and b/example/assets/fonts/ReadexPro/ReadexPro-SemiBold.ttf differ diff --git a/example/ios/ExampleApp.xcodeproj/project.pbxproj b/example/ios/ExampleApp.xcodeproj/project.pbxproj index 8f25af66..547e7d6f 100644 --- a/example/ios/ExampleApp.xcodeproj/project.pbxproj +++ b/example/ios/ExampleApp.xcodeproj/project.pbxproj @@ -17,6 +17,7 @@ 1496A8B0A02F4D198C6837DB /* TitilliumSansPro-Bold-Italic.otf in Resources */ = {isa = PBXBuildFile; fileRef = 6D875C01023D4429A74DBB0A /* TitilliumSansPro-Bold-Italic.otf */; }; 18D8B5E73B2B4973B758990E /* TitilliumSansPro-Black-Italic.otf in Resources */ = {isa = PBXBuildFile; fileRef = D5C8F0FAB4AC4DE99E947795 /* TitilliumSansPro-Black-Italic.otf */; }; 1BC0A570344341E6987FD8D9 /* TitilliumWeb-Italic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = DE7209C9D8E04B9A9E908DC6 /* TitilliumWeb-Italic.ttf */; }; + 2097F76B68D349EFBD2A8A4C /* ReadexPro-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 2473ADE2FEB04232B7E24471 /* ReadexPro-SemiBold.ttf */; }; 2A76089ABE4E4D1E8E88ECFE /* TitilliumWeb-BoldItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9AB3748E146C445A8EDEBF6B /* TitilliumWeb-BoldItalic.ttf */; }; 3347048F785740F8889D46E8 /* TitilliumWeb-SemiBoldItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = A0DECA6E14564D48A132C4F2 /* TitilliumWeb-SemiBoldItalic.ttf */; }; 346BED8DBF064AC6A83A1DE8 /* TitilliumSansPro-Semibold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 828AB8F6DBFA4CE19BF7EA31 /* TitilliumSansPro-Semibold.otf */; }; @@ -67,6 +68,7 @@ 1A640F5E715149C2821B1867 /* TitilliumSansPro-Light.otf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "TitilliumSansPro-Light.otf"; path = "../assets/fonts/TitilliumSansPro/TitilliumSansPro-Light.otf"; sourceTree = ""; }; 1CFF1D50D36F43F2BC0D124F /* LICENSE.txt */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = LICENSE.txt; path = ../assets/fonts/TitilliumSansPro/LICENSE.txt; sourceTree = ""; }; 1E50F38389644583B83DCCCA /* DMMono-Medium.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "DMMono-Medium.ttf"; path = "../assets/fonts/DMMono/DMMono-Medium.ttf"; sourceTree = ""; }; + 2473ADE2FEB04232B7E24471 /* ReadexPro-SemiBold.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "ReadexPro-SemiBold.ttf"; path = "../assets/fonts/ReadexPro/ReadexPro-SemiBold.ttf"; sourceTree = ""; }; 2AC7977FFCF2471A93B6E66B /* TitilliumWeb-Light.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "TitilliumWeb-Light.ttf"; path = "../assets/fonts/TitilliumWeb/TitilliumWeb-Light.ttf"; sourceTree = ""; }; 2D62B8E69F8B41E6B8432E86 /* TitilliumWeb-Bold.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "TitilliumWeb-Bold.ttf"; path = "../assets/fonts/TitilliumWeb/TitilliumWeb-Bold.ttf"; sourceTree = ""; }; 3B4392A12AC88292D35C810B /* Pods-ExampleApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ExampleApp.debug.xcconfig"; path = "Target Support Files/Pods-ExampleApp/Pods-ExampleApp.debug.xcconfig"; sourceTree = ""; }; @@ -219,6 +221,7 @@ 3DE40C756739486AA1D51FCE /* TitilliumSansPro-Thin-Italic.otf */, 4FC6145EC4A14796982CAE22 /* TitilliumSansPro-Thin.otf */, 1CFF1D50D36F43F2BC0D124F /* LICENSE.txt */, + 2473ADE2FEB04232B7E24471 /* ReadexPro-SemiBold.ttf */, ); name = Resources; path = ""; @@ -357,6 +360,7 @@ EC846EA2DBCB4719B953F423 /* TitilliumSansPro-Thin-Italic.otf in Resources */, 116E6480B9914941A6254F71 /* TitilliumSansPro-Thin.otf in Resources */, 493FA456AB57478891021E84 /* LICENSE.txt in Resources */, + 2097F76B68D349EFBD2A8A4C /* ReadexPro-SemiBold.ttf in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/example/ios/ExampleApp/Info.plist b/example/ios/ExampleApp/Info.plist index 310cbaa9..c29b3205 100644 --- a/example/ios/ExampleApp/Info.plist +++ b/example/ios/ExampleApp/Info.plist @@ -80,6 +80,7 @@ TitilliumSansPro-Semibold.otf TitilliumSansPro-Thin-Italic.otf TitilliumSansPro-Thin.otf + ReadexPro-SemiBold.ttf diff --git a/example/ios/link-assets-manifest.json b/example/ios/link-assets-manifest.json index 88ef8333..cdfdefbc 100644 --- a/example/ios/link-assets-manifest.json +++ b/example/ios/link-assets-manifest.json @@ -101,6 +101,10 @@ "path": "assets/fonts/ReadexPro/ReadexPro-Regular.ttf", "sha1": "93e4080794b725f216a94b57ed62a51bc77bce91" }, + { + "path": "assets/fonts/ReadexPro/ReadexPro-SemiBold.ttf", + "sha1": "b4ec28a6b1ba6ed730beb37f06b1b81c5e2163a3" + }, { "path": "assets/fonts/DMMono/DMMono-Medium.ttf", "sha1": "0ceec76262c08cec6c956e1ffe2bfc60321e8f58" diff --git a/example/src/pages/Typography.tsx b/example/src/pages/Typography.tsx index 83e13ca9..8a30f585 100644 --- a/example/src/pages/Typography.tsx +++ b/example/src/pages/Typography.tsx @@ -4,6 +4,7 @@ import { ButtonText, Caption, Chip, + Divider, H1, H2, H3, @@ -17,7 +18,14 @@ import { LabelLink, LabelSmall, LabelSmallAlt, - VSpacer + MdH1, + MdH2, + MdH3, + MdH4, + MdH5, + MdH6, + VSpacer, + VStack } from "@pagopa/io-app-design-system"; import * as React from "react"; import { Alert, StyleSheet, View } from "react-native"; @@ -35,36 +43,53 @@ const styles = StyleSheet.create({ export const Typography = () => ( - - - - - - - - - - - - - Body - - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam a felis - congue, congue leo sit amet, semper ex. Nulla consectetur non quam vel - porttitor. Vivamus ac ex non nunc pellentesque molestie. Aliquam id lorem - aliquam, aliquam massa eget, commodo erat. Maecenas finibus dui massa, - eget pharetra mauris posuere semper. - - - BodyMonoSpace - + + + + + + + + + + + + + + + Body + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam a felis + congue, congue leo sit amet, semper ex. Nulla consectetur non quam vel + porttitor. Vivamus ac ex non nunc pellentesque molestie. Aliquam id + lorem aliquam, aliquam massa eget, commodo erat. Maecenas finibus dui + massa, eget pharetra mauris posuere semper. + + BodyMonoSpace + + + + + + Alert.alert("onPress LabelLink!")}> + LabelLink + + + + + + + + + + + + + + + + - - - - Alert.alert("onPress LabelLink!")}> - LabelLink - ); @@ -81,174 +106,177 @@ export const DarkBackgroundTypographicScale = () => ( ); export const HeroRow = () => ( - <> - - {getTitle("Hero")} - {getLongerTitle("Hero")} - - - + + {getTitle("Hero")} + {getLongerTitle("Hero")} + ); export const H1Row = () => ( - <> - -

{getTitle("H1")}

-

{getLongerTitle("H1")}

-
- - + +

{getTitle("H1")}

+

{getLongerTitle("H1")}

+
); export const H2Row = () => ( - <> - -

{getTitle("H2")}

-

{getLongerTitle("H2")}

-
- - + +

{getTitle("H2")}

+

{getLongerTitle("H2")}

+
); export const H3Row = () => ( - <> - -

Header H3

- -

Header H3

- - -

Header H3

-
+ +

Header H3

+ +

Header H3

+ + +

Header H3

- - +
); export const H4Row = () => ( - <> - - {/* Bold */} -

Header H4

- -

Header H4

- - -

Header H4

-
+ + {/* Bold */} +

Header H4

+ +

Header H4

+ + +

Header H4

- - +
); export const H5Row = () => ( - <> - -
Header H5
- -
Header H5
- -
Header H5
-
- - + +
Header H5
+ +
Header H5
+ +
Header H5
+
); export const H6Row = () => ( - <> - -
Header H6
- -
Header H6
- -
Header H6
-
- - + +
Header H6
+ +
Header H6
+ +
Header H6
+
); export const ButtonTextRow = () => ( - <> - - - ButtonText - - - ButtonText - - ButtonText + + + ButtonText - - + + ButtonText + + ButtonText + ); export const CaptionRow = () => ( - <> - - Caption - - Caption - - Caption - - - + + Caption + + Caption + + Caption + ); export const ChipRow = () => ( - <> - - Chip - - Chip - - Chip - - - + + Chip + + Chip + + Chip + ); export const LabelSmallRow = () => ( - <> - - Label small - - Label small - - Label small - - - Label small - + + Label small + + Label small + + Label small + + + Label small - - + ); export const LabelSmallAltRow = () => ( - <> - - Label small alt - - Label small alt - - - Label small alt - + + Label small alt + + Label small alt + + + Label small alt - - + ); export const LabelRow = () => ( - <> - - - - - - + + + + + - - + +); + +export const MdH1Row = () => ( + + {getTitle("Markdown H1")} + {getLongerTitle("Markdown H1")} + +); + +export const MdH2Row = () => ( + + {getTitle("Markdown H2")} + {getLongerTitle("Markdown H2")} + +); + +export const MdH3Row = () => ( + + {getTitle("Markdown H3")} + {getLongerTitle("Markdown H3")} + +); + +export const MdH4Row = () => ( + + {getTitle("Markdown H4")} + {getLongerTitle("Markdown H4")} + +); + +export const MdH5Row = () => ( + + {getTitle("Markdown H5")} + {getLongerTitle("Markdown H5")} + +); + +export const MdH6Row = () => ( + + {getTitle("Markdown H6")} + {getLongerTitle("Markdown H6")} + ); diff --git a/src/components/typography/index.tsx b/src/components/typography/index.tsx index 9fd7b1c0..9fc0bb78 100644 --- a/src/components/typography/index.tsx +++ b/src/components/typography/index.tsx @@ -17,3 +17,9 @@ export * from "./LabelSmallAlt"; export * from "./LabelLink"; export * from "./BodyMonospace"; export * from "./common"; +export * from "./markdown/MdH1"; +export * from "./markdown/MdH2"; +export * from "./markdown/MdH3"; +export * from "./markdown/MdH4"; +export * from "./markdown/MdH5"; +export * from "./markdown/MdH6"; diff --git a/src/components/typography/markdown/MdH1.tsx b/src/components/typography/markdown/MdH1.tsx new file mode 100644 index 00000000..03a86626 --- /dev/null +++ b/src/components/typography/markdown/MdH1.tsx @@ -0,0 +1,32 @@ +import { IOColors, IOTheme } from "../../../core"; +import { FontFamily, IOFontWeight } from "../../../utils/fonts"; +import { ExternalTypographyProps, TypographyProps } from "../common"; +import { useTypographyFactory } from "../Factory"; + +type AllowedColors = Extract | IOColors; +type AllowedWeight = Extract; + +type MdH1Props = ExternalTypographyProps< + TypographyProps +>; + +const fontSize = 20; +const lineHeight = 24; +const font: FontFamily = "ReadexPro"; +const defaultColor: AllowedColors = "black"; +const defaultWeight: AllowedWeight = "Regular"; + +/** + * `MdH1` typographic style + */ +export const MdH1 = (props: MdH1Props) => + useTypographyFactory({ + ...props, + defaultWeight, + defaultColor, + font, + fontStyle: { + fontSize, + lineHeight + } + }); diff --git a/src/components/typography/markdown/MdH2.tsx b/src/components/typography/markdown/MdH2.tsx new file mode 100644 index 00000000..f73fa377 --- /dev/null +++ b/src/components/typography/markdown/MdH2.tsx @@ -0,0 +1,32 @@ +import { IOColors, IOTheme } from "../../../core"; +import { FontFamily, IOFontWeight } from "../../../utils/fonts"; +import { ExternalTypographyProps, TypographyProps } from "../common"; +import { useTypographyFactory } from "../Factory"; + +type AllowedColors = Extract | IOColors; +type AllowedWeight = Extract; + +type MdH2Props = ExternalTypographyProps< + TypographyProps +>; + +const fontSize = 16; +const lineHeight = 24; +const font: FontFamily = "ReadexPro"; +const defaultColor: AllowedColors = "black"; +const defaultWeight: AllowedWeight = "SemiBold"; + +/** + * `MdH2` typographic style + */ +export const MdH2 = (props: MdH2Props) => + useTypographyFactory({ + ...props, + defaultWeight, + defaultColor, + font, + fontStyle: { + fontSize, + lineHeight + } + }); diff --git a/src/components/typography/markdown/MdH3.tsx b/src/components/typography/markdown/MdH3.tsx new file mode 100644 index 00000000..a72ea3e2 --- /dev/null +++ b/src/components/typography/markdown/MdH3.tsx @@ -0,0 +1,32 @@ +import { IOColors, IOTheme } from "../../../core"; +import { FontFamily, IOFontWeight } from "../../../utils/fonts"; +import { ExternalTypographyProps, TypographyProps } from "../common"; +import { useTypographyFactory } from "../Factory"; + +type AllowedColors = Extract | IOColors; +type AllowedWeight = Extract; + +type MdH3Props = ExternalTypographyProps< + TypographyProps +>; + +const fontSize = 16; +const lineHeight = 24; +const font: FontFamily = "ReadexPro"; +const defaultColor: AllowedColors = "black"; +const defaultWeight: AllowedWeight = "Regular"; + +/** + * `MdH3` typographic style + */ +export const MdH3 = (props: MdH3Props) => + useTypographyFactory({ + ...props, + defaultWeight, + defaultColor, + font, + fontStyle: { + fontSize, + lineHeight + } + }); diff --git a/src/components/typography/markdown/MdH4.tsx b/src/components/typography/markdown/MdH4.tsx new file mode 100644 index 00000000..ee6f8cc8 --- /dev/null +++ b/src/components/typography/markdown/MdH4.tsx @@ -0,0 +1,34 @@ +import { IOColors, IOTheme } from "../../../core"; +import { FontFamily, IOFontWeight } from "../../../utils/fonts"; +import { ExternalTypographyProps, TypographyProps } from "../common"; +import { useTypographyFactory } from "../Factory"; + +type AllowedColors = Extract | IOColors; +type AllowedWeight = Extract; + +type MdH4Props = ExternalTypographyProps< + TypographyProps +>; + +const fontSize = 14; +const lineHeight = 24; +const font: FontFamily = "TitilliumSansPro"; +const defaultColor: AllowedColors = "grey-700"; +const defaultWeight: AllowedWeight = "SemiBold"; + +/** + * `MdH4` typographic style + */ +export const MdH4 = (props: MdH4Props) => + useTypographyFactory({ + ...props, + defaultWeight, + defaultColor, + font, + fontStyle: { + fontSize, + textTransform: "uppercase", + letterSpacing: 0.5, + lineHeight + } + }); diff --git a/src/components/typography/markdown/MdH5.tsx b/src/components/typography/markdown/MdH5.tsx new file mode 100644 index 00000000..c127a621 --- /dev/null +++ b/src/components/typography/markdown/MdH5.tsx @@ -0,0 +1,32 @@ +import { IOColors, IOTheme } from "../../../core"; +import { FontFamily, IOFontWeight } from "../../../utils/fonts"; +import { ExternalTypographyProps, TypographyProps } from "../common"; +import { useTypographyFactory } from "../Factory"; + +type AllowedColors = Extract | IOColors; +type AllowedWeight = Extract; + +type MdH5Props = ExternalTypographyProps< + TypographyProps +>; + +const fontSize = 12; +const lineHeight = 16; +const font: FontFamily = "ReadexPro"; +const defaultColor: AllowedColors = "grey-850"; +const defaultWeight: AllowedWeight = "Regular"; + +/** + * `MdH5` typographic style + */ +export const MdH5 = (props: MdH5Props) => + useTypographyFactory({ + ...props, + defaultWeight, + defaultColor, + font, + fontStyle: { + fontSize, + lineHeight + } + }); diff --git a/src/components/typography/markdown/MdH6.tsx b/src/components/typography/markdown/MdH6.tsx new file mode 100644 index 00000000..30f23e29 --- /dev/null +++ b/src/components/typography/markdown/MdH6.tsx @@ -0,0 +1,33 @@ +import { IOColors, IOTheme } from "../../../core"; +import { FontFamily, IOFontWeight } from "../../../utils/fonts"; +import { ExternalTypographyProps, TypographyProps } from "../common"; +import { useTypographyFactory } from "../Factory"; + +type AllowedColors = Extract | IOColors; +type AllowedWeight = Extract; + +type MdH6Props = ExternalTypographyProps< + TypographyProps +>; + +const fontSize = 10; +const lineHeight = 14; +const font: FontFamily = "ReadexPro"; +const defaultColor: AllowedColors = "grey-700"; +const defaultWeight: AllowedWeight = "Regular"; + +/** + * `MdH5` typographic style + */ +export const MdH6 = (props: MdH6Props) => + useTypographyFactory({ + ...props, + defaultWeight, + defaultColor, + font, + fontStyle: { + fontSize, + lineHeight, + letterSpacing: 0.5 + } + });