Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
IODSExperimentalContextProvider,
IONewTypefaceContextProvider,
IOThemeContextProvider,
ToastProvider
} from "@pagopa/io-app-design-system";
Expand All @@ -18,15 +17,13 @@ export default function App() {
<GestureHandlerRootView style={{ flex: 1 }}>
<SafeAreaProvider>
<IODSExperimentalContextProvider>
<IONewTypefaceContextProvider>
<IOThemeContextProvider theme={colorScheme}>
<StatusBannerProvider>
<ToastProvider>
<AppNavigator />
</ToastProvider>
</StatusBannerProvider>
</IOThemeContextProvider>
</IONewTypefaceContextProvider>
<IOThemeContextProvider theme={colorScheme}>
<StatusBannerProvider>
<ToastProvider>
<AppNavigator />
</ToastProvider>
</StatusBannerProvider>
</IOThemeContextProvider>
</IODSExperimentalContextProvider>
</SafeAreaProvider>
</GestureHandlerRootView>
Expand Down
8 changes: 1 addition & 7 deletions example/src/pages/MainScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
ListItemSwitch,
VSpacer,
useIOExperimentalDesign,
useIONewTypeface,
useIOThemeContext
} from "@pagopa/io-app-design-system";
import * as React from "react";
Expand Down Expand Up @@ -59,7 +58,7 @@ const DESIGN_SYSTEM_SECTION_DATA = [
const MainScreen = (props: Props) => {
const { setTheme, themeType, theme } = useIOThemeContext();
const { isExperimental, setExperimental } = useIOExperimentalDesign();
const { newTypefaceEnabled, setNewTypefaceEnabled } = useIONewTypeface();

const renderDSNavItem = ({
item: { title, route }
}: {
Expand Down Expand Up @@ -98,11 +97,6 @@ const MainScreen = (props: Props) => {
value={isExperimental}
onSwitchValueChange={setExperimental}
/>
<ListItemSwitch
label="Abilita nuovo carattere"
value={newTypefaceEnabled}
onSwitchValueChange={setNewTypefaceEnabled}
/>
<VSpacer size={4} />
<ListItemSwitch
label="Abilita Dark Mode"
Expand Down
5 changes: 2 additions & 3 deletions src/components/badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
View,
ViewStyle
} from "react-native";
import { useIONewTypeface, useIOThemeContext } from "../../context";
import { useIOThemeContext } from "../../context";
import {
hexToRgba,
IOBadgeHSpacing,
Expand Down Expand Up @@ -68,7 +68,6 @@ export const Badge = ({
}: Badge) => {
const { dynamicFontScale } = useIOFontDynamicScale();
const { themeType } = useIOThemeContext();
const { newTypefaceEnabled } = useIONewTypeface();

const bgOpacityDarkMode = 0.2;

Expand Down Expand Up @@ -212,7 +211,7 @@ export const Badge = ({
>
<IOText
allowFontScaling={allowFontScaling}
font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
font={"Titillio"}
weight={"Semibold"}
size={12}
lineHeight={16}
Expand Down
5 changes: 2 additions & 3 deletions src/components/banner/Banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
ViewStyle
} from "react-native";
import Animated from "react-native-reanimated";
import { useIONewTypeface, useIOTheme, useIOThemeContext } from "../../context";
import { useIOTheme, useIOThemeContext } from "../../context";
import { IOBannerBigSpacing, IOBannerRadius } from "../../core";
import { hexToRgba, IOColors } from "../../core/IOColors";
import { useScaleAnimation } from "../../hooks";
Expand Down Expand Up @@ -141,7 +141,6 @@ export const Banner = forwardRef<View, Banner>(
}: Banner,
viewRef
) => {
const { newTypefaceEnabled } = useIONewTypeface();
const { onPressIn, onPressOut, scaleAnimatedStyle } =
useScaleAnimation("medium");
const { themeType } = useIOThemeContext();
Expand Down Expand Up @@ -198,7 +197,7 @@ export const Banner = forwardRef<View, Banner>(
>
<VSpacer size={8} />
<IOText
font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
font={"Titillio"}
weight="Semibold"
color={colorMainButton}
size={buttonTextFontSize}
Expand Down
5 changes: 2 additions & 3 deletions src/components/buttons/ButtonLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Animated, {
useAnimatedStyle,
useReducedMotion
} from "react-native-reanimated";
import { useIONewTypeface, useIOTheme } from "../../context";
import { useIOTheme } from "../../context";
import {
IOButtonStyles,
IOColors,
Expand Down Expand Up @@ -85,7 +85,6 @@ export const ButtonLink = forwardRef<View, ButtonLinkProps>(
ref
) => {
const theme = useIOTheme();
const { newTypefaceEnabled } = useIONewTypeface();
const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
useScaleAnimation();
const reducedMotion = useReducedMotion();
Expand Down Expand Up @@ -198,7 +197,7 @@ export const ButtonLink = forwardRef<View, ButtonLinkProps>(
accessible={false}
accessibilityElementsHidden
importantForAccessibility="no-hide-descendants"
font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
font={"Titillio"}
weight={"Semibold"}
size={buttonTextFontSize}
lineHeight={buttonTextLineHeight}
Expand Down
5 changes: 2 additions & 3 deletions src/components/buttons/ButtonOutline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import Animated, {
useAnimatedStyle,
useReducedMotion
} from "react-native-reanimated";
import { useIONewTypeface, useIOTheme } from "../../context";
import { useIOTheme } from "../../context";
import { IOButtonStyles, IOColors, hexToRgba } from "../../core/";
import { useScaleAnimation } from "../../hooks";
import { WithTestID } from "../../utils/types";
Expand Down Expand Up @@ -85,7 +85,6 @@ export const ButtonOutline = forwardRef<View, ButtonOutline>(
ref
) => {
const theme = useIOTheme();
const { newTypefaceEnabled } = useIONewTypeface();
const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
useScaleAnimation();
const reducedMotion = useReducedMotion();
Expand Down Expand Up @@ -235,7 +234,7 @@ export const ButtonOutline = forwardRef<View, ButtonOutline>(
/>
))}
<AnimatedIOText
font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
font={"Titillio"}
weight={"Semibold"}
size={buttonTextFontSize}
accessible={false}
Expand Down
4 changes: 1 addition & 3 deletions src/components/buttons/IOButton/IOButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import Animated, {
LayoutAnimationConfig,
useReducedMotion
} from "react-native-reanimated";
import { useIONewTypeface } from "../../../context";
import {
enterTransitionInnerContent,
enterTransitionInnerContentSmall,
Expand Down Expand Up @@ -139,7 +138,6 @@ export const IOButton = forwardRef<View, IOButtonProps>(
const { buttonAnimatedStyle, labelAnimatedStyle, iconColorAnimatedStyle } =
useButtonAnimatedStyles(variant, color, progress);
const reducedMotion = useReducedMotion();
const { newTypefaceEnabled } = useIONewTypeface();

const isLinkButton = variant === "link";

Expand Down Expand Up @@ -268,7 +266,7 @@ export const IOButton = forwardRef<View, IOButtonProps>(
/>
))}
<AnimatedIOText
font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
font={"Titillio"}
weight={"Semibold"}
size={buttonTextFontSize}
lineHeight={isLinkButton ? buttonTextLineHeight : undefined}
Expand Down
6 changes: 2 additions & 4 deletions src/components/headers/HeaderSecondLevel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Animated, {
withTiming
} from "react-native-reanimated";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { useIONewTypeface, useIOTheme } from "../../context";
import { useIOTheme } from "../../context";
import {
IOColors,
IOSpringValues,
Expand Down Expand Up @@ -164,8 +164,6 @@ export const HeaderSecondLevel = ({

const titleRef = createRef<View>();

const { newTypefaceEnabled } = useIONewTypeface();

const theme = useIOTheme();
const insets = useSafeAreaInsets();
const isTitleAccessible = useMemo(() => !!title.trim(), [title]);
Expand Down Expand Up @@ -338,7 +336,7 @@ export const HeaderSecondLevel = ({
size={14}
numberOfLines={1}
accessible={false}
font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
font={"Titillio"}
weight={"Semibold"}
style={[
{ color: titleColor, textAlign: "center" },
Expand Down
5 changes: 2 additions & 3 deletions src/components/modules/ModuleIDP.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react";
import { Image, ImageSourcePropType, StyleSheet } from "react-native";
import { useIONewTypeface, useIOThemeContext, useIOTheme } from "../../context";
import { useIOThemeContext, useIOTheme } from "../../context";
import { IOListItemLogoMargin } from "../../core";
import { addCacheTimestampToUri } from "../../utils/image";
import { IOText } from "../typography";
Expand Down Expand Up @@ -50,7 +50,6 @@ export const ModuleIDP = ({
testID,
accessibilityLabel
}: ModuleIDP) => {
const { newTypefaceEnabled } = useIONewTypeface();
const theme = useIOTheme();
const IDPLogoSource = useIDPLogo(logo);

Expand All @@ -61,7 +60,7 @@ export const ModuleIDP = ({
withLooseSpacing={withLooseSpacing}
>
<IOText
font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
font={"Titillio"}
weight={"Semibold"}
size={12}
lineHeight={16}
Expand Down
5 changes: 2 additions & 3 deletions src/components/numberpad/NumberButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Animated, {
useAnimatedStyle,
useReducedMotion
} from "react-native-reanimated";
import { useIONewTypeface, useIOTheme } from "../../context";
import { useIOTheme } from "../../context";
import { hexToRgba, IOColors } from "../../core";
import { useScaleAnimation } from "../../hooks";
import { IOText } from "../typography";
Expand Down Expand Up @@ -50,7 +50,6 @@ export const NumberButton = memo(
const { progress, onPressIn, onPressOut, scaleAnimatedStyle } =
useScaleAnimation("medium");
const reducedMotion = useReducedMotion();
const { newTypefaceEnabled } = useIONewTypeface();

const colorMap: Record<NumberButtonVariantType, ColorMapVariant> = useMemo(
() => ({
Expand Down Expand Up @@ -103,7 +102,7 @@ export const NumberButton = memo(
>
<IOText
size={22}
font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
font={"Titillio"}
weight="Semibold"
color={colorMap[variant].foreground}
style={{
Expand Down
7 changes: 3 additions & 4 deletions src/components/searchInput/SearchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import Animated, {
withTiming
} from "react-native-reanimated";
import { WithTestID } from "src/utils/types";
import { useIONewTypeface, useIOTheme } from "../../context";
import { useIOTheme } from "../../context";
import { IOColors, IOSpacingScale, IOVisualCostants } from "../../core";
import {
IOFontSize,
Expand Down Expand Up @@ -114,7 +114,6 @@ export const SearchInput = forwardRef<SearchInputRef, SearchInputProps>(
ref
) => {
const searchInputRef = useRef<TextInput>(null);
const { newTypefaceEnabled } = useIONewTypeface();

/* Component visual attributes */
const theme = useIOTheme();
Expand Down Expand Up @@ -264,7 +263,7 @@ export const SearchInput = forwardRef<SearchInputRef, SearchInputProps>(
color: IOColors[theme["textBody-default"]],
...makeFontStyleObject(
inputFontSizePlaceholder,
newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
"Titillio",
undefined,
"Regular"
)
Expand Down Expand Up @@ -307,7 +306,7 @@ export const SearchInput = forwardRef<SearchInputRef, SearchInputProps>(
>
<IOText
color={theme["interactiveElem-default"]}
font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
font={"Titillio"}
weight={"Semibold"}
size={buttonTextFontSize}
lineHeight={buttonTextLineHeight}
Expand Down
5 changes: 2 additions & 3 deletions src/components/tabs/TabItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Animated, {
useReducedMotion,
withSpring
} from "react-native-reanimated";
import { useIONewTypeface, useIOTheme } from "../../context";
import { useIOTheme } from "../../context";
import { IOColors, IOSpringValues, hexToRgba } from "../../core";
import { useScaleAnimation } from "../../hooks";
import { WithTestID } from "../../utils/types";
Expand Down Expand Up @@ -77,7 +77,6 @@ const TabItem = forwardRef(
useScaleAnimation("medium");
const theme = useIOTheme();
const reducedMotion = useReducedMotion();
const { newTypefaceEnabled } = useIONewTypeface();

const mapColorStates: Record<
NonNullable<TabItem["color"]>,
Expand Down Expand Up @@ -201,7 +200,7 @@ const TabItem = forwardRef(
)}
<IOText
size={14}
font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
font={"Titillio"}
weight="Semibold"
color={foregroundColor}
>
Expand Down
5 changes: 2 additions & 3 deletions src/components/tag/Tag.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { Platform, StyleSheet, View, ViewStyle } from "react-native";
import { useIONewTypeface, useIOTheme } from "../../context";
import { useIOTheme } from "../../context";
import {
IOColors,
IOSpacingScale,
Expand Down Expand Up @@ -156,7 +156,6 @@ export const Tag = ({
forceLightMode = false
}: Tag) => {
const theme = useIOTheme();
const { newTypefaceEnabled } = useIONewTypeface();
const { dynamicFontScale, spacingScaleMultiplier } = useIOFontDynamicScale();

const variantProps = getVariantProps(variant, icon);
Expand Down Expand Up @@ -204,7 +203,7 @@ export const Tag = ({
{text && (
<IOText
allowFontScaling={allowFontScaling}
font={newTypefaceEnabled ? "Titillio" : "TitilliumSansPro"}
font={"Titillio"}
weight={"Semibold"}
size={12}
lineHeight={16}
Expand Down
7 changes: 3 additions & 4 deletions src/components/textInput/TextInputBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import Animated, {
useSharedValue,
withTiming
} from "react-native-reanimated";
import { useIONewTypeface, useIOTheme } from "../../context";
import { useIOTheme } from "../../context";
import { IOColors, IOSpacingScale, hexToRgba } from "../../core";
import { useIOFontDynamicScale } from "../../utils/accessibility";
import {
Expand Down Expand Up @@ -237,7 +237,6 @@ export const TextInputBase = ({
);
const focusedState = useSharedValue<number>(0);

const { newTypefaceEnabled } = useIONewTypeface();
const { dynamicFontScale, spacingScaleMultiplier } = useIOFontDynamicScale();

const theme = useIOTheme();
Expand Down Expand Up @@ -472,7 +471,7 @@ export const TextInputBase = ({
{
...makeFontStyleObject(
inputLabelFontSize,
newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
"Titillio",
undefined,
"Regular"
)
Expand Down Expand Up @@ -516,7 +515,7 @@ export const TextInputBase = ({
{
...makeFontStyleObject(
inputLabelFontSize,
newTypefaceEnabled ? "Titillio" : "TitilliumSansPro",
"Titillio",
undefined,
"Regular"
),
Expand Down
Loading