Skip to content
Merged
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
2 changes: 1 addition & 1 deletion apps/fluent-tester/src/FluentTesterApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const useSizeClassIOS_DO_NOT_USE: () => SizeClassIOS = () => {

export const FluentTesterApp: React.FunctionComponent<FluentTesterProps> = (props) => {
const sizeClass = useSizeClassIOS_DO_NOT_USE();
const isMobile = Platform.OS == 'android' || (Platform.OS === 'ios' && Platform.isPad === false);
const isMobile = Platform.OS === 'android' || (Platform.OS === 'ios' && Platform.isPad === false);

// If on iPad we are presented in a Split View or Slide Over context, show the single pane view.
const shouldShowSinglePane = isMobile || (!isMobile && sizeClass === 'compact');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { ButtonV1 as Button } from '@fluentui/react-native';
import * as React from 'react';
import { View } from 'react-native';
import { commonTestStyles, testContentRootViewStyle } from '../Common/styles';
import { svgProps } from '../Common/iconExamples';

export const ButtonIconTest: React.FunctionComponent = () => {
const fontBuiltInProps = {
fontFamily: 'Arial',
codepoint: 0x2663,
fontSize: 24,
};

/* eslint-disable @typescript-eslint/no-var-requires */
const testImage = require('../../../../assets/icon_24x24.png');

return (
<View style={testContentRootViewStyle}>
<Button icon={{ fontSource: fontBuiltInProps }} style={commonTestStyles.vmargin}>
Font icon
</Button>
<Button appearance="accent" icon={{ svgSource: svgProps, color: 'black' }} style={commonTestStyles.vmargin}>
SVG
</Button>
<Button icon={testImage} style={commonTestStyles.vmargin}>
PNG
</Button>
</View>
);
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ButtonV1 as Button, CompoundButton } from '@fluentui/react-native';
import { ButtonV1 as Button, CompoundButton, FAB } from '@fluentui/react-native';
import * as React from 'react';
import { Platform, View } from 'react-native';
import { commonTestStyles, testContentRootViewStyle } from '../Common/styles';
Expand Down Expand Up @@ -42,6 +42,12 @@ export const ButtonSizeTest: React.FunctionComponent = () => {
<Button size="large" icon={iconProps} style={commonTestStyles.vmargin}>
Large Button with icon
</Button>
Comment thread
ayush547 marked this conversation as resolved.
<FAB size="small" icon={iconProps} style={commonTestStyles.vmargin}>
Small FAB
</FAB>
<FAB size="large" icon={iconProps} style={commonTestStyles.vmargin}>
Large FAB
</FAB>
</>
)}
<Button size="small" style={commonTestStyles.vmargin}>
Expand All @@ -53,35 +59,39 @@ export const ButtonSizeTest: React.FunctionComponent = () => {
<Button size="large" style={commonTestStyles.vmargin}>
Large
</Button>
<Button loading size="small" style={commonTestStyles.vmargin}>
Loading Button Small
</Button>
<Button loading size="medium" style={commonTestStyles.vmargin}>
Loading Button Medium
</Button>
<Button loading size="large" style={commonTestStyles.vmargin}>
Loading Button Large
</Button>
<CompoundButton secondaryContent="Small compound button" size="small" style={commonTestStyles.vmargin}>
Compound Button
</CompoundButton>
<CompoundButton secondaryContent="Medium compound button" size="medium" style={commonTestStyles.vmargin}>
Compound Button
</CompoundButton>
<CompoundButton secondaryContent="Large compound button" size="large" style={commonTestStyles.vmargin}>
Compound Button
</CompoundButton>
{svgIconsEnabled && (
{Platform.OS !== 'android' && (
<>
<CompoundButton icon={iconProps} secondaryContent="SecondaryContent" size="small" style={commonTestStyles.vmargin}>
Content
<Button loading size="small" style={commonTestStyles.vmargin}>
Loading Button Small
</Button>
<Button loading size="medium" style={commonTestStyles.vmargin}>
Loading Button Medium
</Button>
<Button loading size="large" style={commonTestStyles.vmargin}>
Loading Button Large
</Button>
<CompoundButton secondaryContent="Small compound button" size="small" style={commonTestStyles.vmargin}>
Compound Button
</CompoundButton>
<CompoundButton icon={iconProps} secondaryContent="SecondaryContent" size="medium" style={commonTestStyles.vmargin}>
Content
<CompoundButton secondaryContent="Medium compound button" size="medium" style={commonTestStyles.vmargin}>
Compound Button
</CompoundButton>
<CompoundButton icon={iconProps} secondaryContent="SecondaryContent" size="large" style={commonTestStyles.vmargin}>
Content
<CompoundButton secondaryContent="Large compound button" size="large" style={commonTestStyles.vmargin}>
Compound Button
</CompoundButton>
{svgIconsEnabled && (
<>
<CompoundButton icon={iconProps} secondaryContent="SecondaryContent" size="small" style={commonTestStyles.vmargin}>
Content
</CompoundButton>
<CompoundButton icon={iconProps} secondaryContent="SecondaryContent" size="medium" style={commonTestStyles.vmargin}>
Content
</CompoundButton>
<CompoundButton icon={iconProps} secondaryContent="SecondaryContent" size="large" style={commonTestStyles.vmargin}>
Content
</CompoundButton>
</>
)}
</>
)}
</View>
Expand Down
24 changes: 13 additions & 11 deletions apps/fluent-tester/src/TestComponents/Button/ButtonTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,22 @@ const buttonSections: TestSection[] = [
testID: BUTTON_TESTPAGE,
component: ButtonVariantTest,
},
{
name: 'Button Shape',
component: ButtonShapeTest,
},
{
name: 'Icon Button',
component: ButtonIconTest,
},
Platform.select({
android: null, //Toggle Button is not implemented for Android
default: {
name: 'Toggle Button',
component: ToggleButtonTest,
},
...Platform.select({
android: [null], //Following sections are not supported from Fluent Android
default: [
{
name: 'Toggle Button',
component: ToggleButtonTest,
},
{
name: 'Button Shape',
component: ButtonShapeTest,
},
],
}),
{
name: 'Sizes',
Expand Down Expand Up @@ -66,7 +68,7 @@ export const ButtonTest: React.FunctionComponent = () => {
uwpStatus: 'Experimental',
iosStatus: 'Experimental',
macosStatus: 'Beta',
androidStatus: 'Backlog',
androidStatus: 'Experimental',
};

const description =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { Button, FAB } from '@fluentui-react-native/experimental-button';
import * as React from 'react';
import { View } from 'react-native';
import { commonTestStyles, testContentRootViewStyle } from '../Common/styles';
import { iconProps } from '../Common/iconExamples';

export const ButtonVariantTest: React.FunctionComponent = () => {
const [showFABText, setShowFABText] = React.useState(true);
const flipFABcontent = React.useCallback(() => setShowFABText(!showFABText), [showFABText]);

return (
<View style={testContentRootViewStyle}>
Comment thread
ayush547 marked this conversation as resolved.
<Button style={commonTestStyles.vmargin}>Default</Button>
<Button disabled style={commonTestStyles.vmargin}>
Default Disabled
</Button>
<Button appearance="accent" style={commonTestStyles.vmargin}>
Accent
</Button>
<Button disabled appearance="accent" style={commonTestStyles.vmargin}>
Accent Disabled
</Button>
<Button appearance="outline" style={commonTestStyles.vmargin}>
Outline
</Button>
<Button appearance="outline" disabled style={commonTestStyles.vmargin}>
Outline Disabled
</Button>
<Button appearance="subtle" style={commonTestStyles.vmargin}>
Subtle
</Button>
<Button appearance="subtle" disabled style={commonTestStyles.vmargin}>
Subtle Disabled
</Button>
<FAB icon={iconProps} iconOnly disabled style={commonTestStyles.vmargin} />
<FAB icon={iconProps} style={commonTestStyles.vmargin} showContent={showFABText} onClick={flipFABcontent}>
Click Me!
</FAB>
<FAB appearance="subtle" iconOnly disabled icon={iconProps} style={commonTestStyles.vmargin} />
<FAB appearance="subtle" icon={iconProps} style={commonTestStyles.vmargin} showContent={showFABText} onClick={flipFABcontent}>
Click Me!
</FAB>
</View>
);
};
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { Button, CompoundButton, FAB } from '@fluentui-react-native/experimental-button';
import { Button, CompoundButton } from '@fluentui-react-native/experimental-button';
import * as React from 'react';
import { View } from 'react-native';
import { commonTestStyles, testContentRootViewStyle } from '../Common/styles';
import { svgProps } from '../Common/iconExamples';

// Test also pulls button from deprecated package to ensure it's still working
export const ButtonVariantTest: React.FunctionComponent = () => {
const iconProps = { svgSource: svgProps, width: 20, height: 20 };

const [showFABText, setShowFABText] = React.useState(true);
const flipFABcontent = React.useCallback(() => setShowFABText(!showFABText), [showFABText]);

return (
<View style={testContentRootViewStyle}>
<Button style={commonTestStyles.vmargin}>Default</Button>
Expand Down Expand Up @@ -45,10 +39,6 @@ export const ButtonVariantTest: React.FunctionComponent = () => {
<CompoundButton appearance="subtle" secondaryContent="Compound" style={commonTestStyles.vmargin}>
Subtle
</CompoundButton>
<FAB icon={iconProps} style={commonTestStyles.vmargin} />
<FAB icon={iconProps} style={commonTestStyles.vmargin} showContent={showFABText} onClick={flipFABcontent}>
FAB
</FAB>
</View>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { FAB, Text } from '@fluentui/react-native';
import { commonTestStyles, stackStyle } from '../Common/styles';
import { shadowTestPageStyles } from './ShadowTestPageStyles';
import { useFluentTheme } from '@fluentui-react-native/framework';
import { iconProps } from '../Common/iconExamples';

const CustomFABNoShadow = FAB.customize({ shadowToken: undefined });
const CustomFABShadow64 = FAB.customize({
Expand All @@ -16,9 +17,15 @@ export const ShadowButtonTestSection: React.FunctionComponent = () => {
if (Platform.OS === 'ios') {
return (
<View style={shadowTestPageStyles(t).backgroundColor}>
<FAB style={commonTestStyles.vmargin}>FAB with default shadow</FAB>
<CustomFABShadow64 style={commonTestStyles.vmargin}>Custom FAB with shadow64</CustomFABShadow64>
<CustomFABNoShadow style={commonTestStyles.vmargin}>Custom FAB with no shadow</CustomFABNoShadow>
<FAB icon={iconProps} style={commonTestStyles.vmargin}>
FAB with default shadow
</FAB>
<CustomFABShadow64 icon={iconProps} style={commonTestStyles.vmargin}>
Custom FAB with shadow64
</CustomFABShadow64>
<CustomFABNoShadow icon={iconProps} style={commonTestStyles.vmargin}>
Custom FAB with no shadow
</CustomFABNoShadow>
</View>
);
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Button/FAB Tokenization Complete",
"packageName": "@fluentui-react-native/button",
"email": "ayushsinghs@yahoo.in",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Button/FAB Tokenization Complete",
"packageName": "@fluentui-react-native/experimental-menu-button",
"email": "ayushsinghs@yahoo.in",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Button/FAB Tokenization Complete",
"packageName": "@fluentui-react-native/menu",
"email": "ayushsinghs@yahoo.in",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Button/FAB Tokenization Complete",
"packageName": "@fluentui-react-native/menu-button",
"email": "ayushsinghs@yahoo.in",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Updated tester app text for mobile",
"packageName": "@fluentui-react-native/tester",
"email": "ayushsinghs@yahoo.in",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Added padding start and end to LayoutTokens",
"packageName": "@fluentui-react-native/tokens",
"email": "ayushsinghs@yahoo.in",
"dependentChangeType": "patch"
}
Loading