diff --git a/apps/fluent-tester/src/RNTester/TestComponents/Text/CustomizeUsage.tsx b/apps/fluent-tester/src/RNTester/TestComponents/Text/CustomizeUsage.tsx new file mode 100644 index 000000000..fee3b7a06 --- /dev/null +++ b/apps/fluent-tester/src/RNTester/TestComponents/Text/CustomizeUsage.tsx @@ -0,0 +1,48 @@ +import * as React from 'react'; +import { View } from 'react-native'; +import { Stack } from '@fluentui-react-native/stack'; +import { Text } from '@fluentui-react-native/text'; +import { stackStyle } from '../Common/styles'; +import { styles } from './styles'; + +export const CustomizeUsage: React.FunctionComponent<{}> = () => { + const RedCaptionBold = Text.customize({ tokens: { fontVariant: 'captionStandard', fontWeight: 'semiBold', color: '#ff0000' } }); + const OrangeSecondaryBold = Text.customize({ tokens: { fontVariant: 'secondaryStandard', fontWeight: 'semiBold', color: '#ff9900' } }); + const YellowBodyBold = Text.customize({ tokens: { fontVariant: 'bodyStandard', fontWeight: 'semiBold', color: '#f3ce00' } }); + const GreenSubheaderBold = Text.customize({ tokens: { fontVariant: 'subheaderStandard', fontWeight: 'semiBold', color: '#02c440' } }); + const BlueHeaderBold = Text.customize({ tokens: { fontVariant: 'headerStandard', fontWeight: 'semiBold', color: '#0229c4' } }); + const IndigoHeroBold = Text.customize({ tokens: { fontVariant: 'heroStandard', fontWeight: 'semiBold', color: '#4b0082' } }); + const PurpleHeroLargeBold = Text.customize({ tokens: { fontVariant: 'heroLargeStandard', fontWeight: 'semiBold', color: '#8402c4' } }); + + const ArialBlack = Text.customize({ tokens: { fontVariant: 'heroLargeStandard', fontFamily: 'Arial Black' } }); + const BrushScriptMT = Text.customize({ tokens: { fontVariant: 'heroStandard', fontFamily: 'Brush Script MT' } }); + const CourierNew = Text.customize({ tokens: { fontVariant: 'headerStandard', fontFamily: 'Courier New' } }); + const Georgia = Text.customize({ tokens: { fontVariant: 'subheaderStandard', fontFamily: 'Georgia' } }); + const SegoeScript = Text.customize({ tokens: { fontVariant: 'bodyStandard', fontFamily: 'Segoe Script' } }); + const TimesNewRoman = Text.customize({ tokens: { fontVariant: 'secondaryStandard', fontFamily: 'Times New Roman' } }); + const Wingdings = Text.customize({ tokens: { fontVariant: 'captionStandard', fontFamily: 'Wingdings' } }); + + return ( + + + RedCaptionBold + OrangeSecondaryBold + YellowBodyBold + GreenSubheaderBold + BlueHeaderBold + IndigoHeroBold + PurpleHeroLargeBold + + + + Arial Black + Brush Script MT + Courier New + Georgia + Segoe Script + TimesNewRoman + Wingdings + + + ); +}; diff --git a/apps/fluent-tester/src/RNTester/TestComponents/Text/StandardUsage.tsx b/apps/fluent-tester/src/RNTester/TestComponents/Text/StandardUsage.tsx new file mode 100644 index 000000000..7520c1024 --- /dev/null +++ b/apps/fluent-tester/src/RNTester/TestComponents/Text/StandardUsage.tsx @@ -0,0 +1,24 @@ +import * as React from 'react'; +import { View } from 'react-native'; +import { Text } from '@fluentui-react-native/text'; +import { styles } from './styles'; + +export const StandardUsage: React.FunctionComponent<{}> = () => { + return ( + + CaptionStandard + SecondaryStandard + SecondarySemibold + BodyStandard + BodySemibold + SubheaderStandard + SubheaderSemibold + HeaderStandard + HeaderSemibold + HeroStandard + HeroSemibold + HeroLargeStandard + HeroLargeSemibold + + ); +}; diff --git a/apps/fluent-tester/src/RNTester/TestComponents/Text/TextTest.tsx b/apps/fluent-tester/src/RNTester/TestComponents/Text/TextTest.tsx new file mode 100644 index 000000000..28352c7e0 --- /dev/null +++ b/apps/fluent-tester/src/RNTester/TestComponents/Text/TextTest.tsx @@ -0,0 +1,21 @@ +import * as React from 'react'; +import { View } from 'react-native'; +import { Separator } from '@fluentui-react-native/separator'; +import { StandardUsage } from './StandardUsage'; +import { CustomizeUsage } from './CustomizeUsage'; +import { styles } from './styles'; +import { Text } from '@fluentui-react-native/text'; + +export const TextTest: React.FunctionComponent<{}> = () => { + return ( + + Standard Usage + + + + Customize Usage + + + + ); +}; diff --git a/apps/fluent-tester/src/RNTester/TestComponents/Text/index.ts b/apps/fluent-tester/src/RNTester/TestComponents/Text/index.ts new file mode 100644 index 000000000..d761e5963 --- /dev/null +++ b/apps/fluent-tester/src/RNTester/TestComponents/Text/index.ts @@ -0,0 +1 @@ +export * from './TextTest'; diff --git a/apps/fluent-tester/src/RNTester/TestComponents/Text/styles.ts b/apps/fluent-tester/src/RNTester/TestComponents/Text/styles.ts new file mode 100644 index 000000000..8dd95be97 --- /dev/null +++ b/apps/fluent-tester/src/RNTester/TestComponents/Text/styles.ts @@ -0,0 +1,16 @@ +import { StyleSheet } from 'react-native'; + +export const styles = StyleSheet.create({ + root: { + marginTop: 16, + marginRight: 32, + flexDirection: 'column', + alignItems: 'flex-start' + }, + section: { + fontSize: 15, + fontWeight: 'bold', + color: '#0B6A0B', + marginTop: 12 + } +}); diff --git a/apps/fluent-tester/src/RNTester/TestComponents/Theme/ThemeTest.tsx b/apps/fluent-tester/src/RNTester/TestComponents/Theme/ThemeTest.tsx index 14b592850..4d9d722f7 100644 --- a/apps/fluent-tester/src/RNTester/TestComponents/Theme/ThemeTest.tsx +++ b/apps/fluent-tester/src/RNTester/TestComponents/Theme/ThemeTest.tsx @@ -1,207 +1,207 @@ -import * as React from 'react'; -import * as ReactNative from 'react-native'; -import { getHostSettingsWin32, ThemeProvider, useTheme, IThemeDefinition, ThemingModuleHelper } from '@uifabricshared/theming-react-native'; -import { themedStyleSheet } from '@uifabricshared/themed-stylesheet'; -import { commonTestStyles } from '../Common/styles'; -import { Button, PrimaryButton, Separator, StealthButton, Text, RadioGroup, RadioButton } from '@fluentui/react-native'; -import { ITheme, IPartialTheme } from '@uifabricshared/theming-ramp'; -import { customRegistry } from './CustomThemes'; - -let brand = 'Office'; - -const brandColors = { - Word: ['#E3ECFA', '#A5B9D1', '#7DA3C6', '#4A78B0', '#3C65A4', '#2B579A', '#124078', '#002050'], - Excel: ['#E9F5EE', '#9FCDB3', '#6EB38A', '#4E9668', '#3F8159', '#217346', '#0E5C2F', '#004B1C'], - Powerpoint: ['#FCF0ED', '#FDC9B5', '#ED9583', '#E86E58', '#C75033', '#B7472A', '#A92B1A', '#740912'], - Outlook: ['#CCE3F5', '#B3D6F2', '#69AFE5', '#2488D8', '#0078D7', '#106EBE', '#1664A7', '#135995'] -}; - -// This IProcessTheme takes the parent theme and shims in the brand colors selected in the RadioGroup -const fakeBrandTheme: IThemeDefinition = (theme: ITheme): IPartialTheme => { - if (brand === 'Office') { - return {}; - } - - const brandValues = theme.colors.brand.values; - const brandedTheme = { colors: {}, host: { palette: {} } }; - Object.keys(theme.colors).forEach((value: string) => { - if (typeof theme.colors[value] === 'string') { - const index = brandValues.indexOf(theme.colors[value].toString()); - if (index !== -1) brandedTheme.colors[value] = brandColors[brand][index]; - } - }); - - const hostThemeSettings = getHostSettingsWin32(theme); - if (hostThemeSettings === undefined) return brandedTheme; - - Object.keys(hostThemeSettings.palette).forEach((value: string) => { - const index = brandValues.indexOf(hostThemeSettings.palette[value].toString()); - if (index !== -1) brandedTheme.host.palette[value] = brandColors[brand][index]; - }); - return brandedTheme; -}; - -// this applies the shim to the default theme -customRegistry.setTheme(fakeBrandTheme, 'Default'); -// this registers platform white colors -customRegistry.setTheme(ThemingModuleHelper.getPlatformThemeDefinition('WhiteColors'), 'RealWhiteColors'); -// this applies the shim to the white colors theme -customRegistry.setTheme(fakeBrandTheme, 'WhiteColors', 'RealWhiteColors'); - -const getThemedStyles = themedStyleSheet((theme: ITheme) => { - const hostSettings = getHostSettingsWin32(theme); - return { - swatch: { - width: 80, - height: 20, - marginRight: 5, - borderWidth: 2, - borderColor: theme.colors.bodyText - }, - extraLargeStandardEmphasis: { - color: hostSettings ? hostSettings.palette.TextEmphasis : theme.colors.bodyText, - fontSize: theme.typography.sizes.xxLarge, - fontWeight: theme.typography.weights.medium, - fontFamily: theme.typography.families.primary - } as ReactNative.TextStyle, - largeStandard: { - color: theme.colors.bodyText, - fontSize: theme.typography.sizes.large, - fontWeight: theme.typography.weights.medium, - fontFamily: theme.typography.families.primary, - marginBottom: 5 - } as ReactNative.TextStyle, - stackStyle: { - borderWidth: 2, - borderColor: theme.colors.focusBorder, - padding: 12, - margin: 8, - backgroundColor: theme.colors.background - } - }; -}); - -const styles = ReactNative.StyleSheet.create({ - swatchItem: { - flexDirection: 'row', - alignItems: 'center', - marginVertical: 5 - }, - pickerContainer: { - flexDirection: 'row', - justifyContent: 'space-evenly' - } -}); - -const Panel: React.FunctionComponent = () => { - const [disabled, setDisabled] = React.useState(false); - const onClick = React.useCallback(() => setDisabled(!disabled), [disabled, setDisabled]); - const themedStyles = getThemedStyles(useTheme()); - return ( - - -