Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Card: Improving styling and adding compact Card styling and examples #8247

Merged
merged 39 commits into from
Mar 29, 2019
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
15eacf1
Adding pre-copy.json creation step and template when using create-pac…
khmakoto Mar 7, 2019
f652242
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
khmakoto Mar 7, 2019
fa82413
Improving styling of basic Cards and adding example of compact Card.
khmakoto Mar 7, 2019
b544d3c
Adding compact Card styling and examples.
khmakoto Mar 8, 2019
5ae2539
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
khmakoto Mar 8, 2019
a3e7d7e
Adding change file.
khmakoto Mar 8, 2019
6d57ee1
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
Mar 13, 2019
c0ae063
Adding margin as token to StackItem and removing CardItem types.
Mar 13, 2019
499aade
Removing gaps and paddings from examples
Mar 13, 2019
85e4866
Leaving margin token as undefined.
Mar 13, 2019
752a7ad
Adding OUFR change file.
Mar 14, 2019
d92c479
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
Mar 14, 2019
5969ffc
Adding childrenGap token to Stack and Card.
Mar 15, 2019
31f5cb5
Changing styling of Card and extending IStackTokens in ICardTokens
Mar 15, 2019
59bd6df
Adding @uifabric/experiments change file.
khmakoto Mar 18, 2019
18891f4
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
khmakoto Mar 18, 2019
b664e14
Merge branch 'cardApi' of github.com:khmakoto/office-ui-fabric-react …
khmakoto Mar 18, 2019
a25888c
Updating create component to be able to pass tokens in view.
Mar 20, 2019
6649eed
Adding foundation change file.
Mar 20, 2019
050767b
Merge branch 'cardApi' of github.com:khmakoto/office-ui-fabric-react …
Mar 20, 2019
47e2432
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
Mar 20, 2019
ae12317
Removing console.log statement and updating webpack config.
Mar 20, 2019
178c748
Styling changes to adhere more to design guideline and example updates.
khmakoto Mar 21, 2019
8d99cb8
Getting rid of alt prop in Image.
khmakoto Mar 21, 2019
b322345
Updating snapshots.
khmakoto Mar 21, 2019
3bafbf7
Merge branch 'master' into khmakoto/cardApi
natalieethell Mar 26, 2019
a2d05cb
Delete merge-styles.api.ts
natalieethell Mar 26, 2019
4ae5511
Fixing merge conflict.
khmakoto Mar 27, 2019
ad720fb
Merge branch 'cardApi' of github.com:khmakoto/office-ui-fabric-react …
khmakoto Mar 28, 2019
9b2290b
Updating examples to centralize tokens instead of using them inline.
khmakoto Mar 28, 2019
bb7bc1e
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
khmakoto Mar 28, 2019
834b48d
Updating Dropdown examples to have token centralization.
khmakoto Mar 28, 2019
db83ae5
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
khmakoto Mar 28, 2019
0d1e5b2
Adding merge-styles change file.
khmakoto Mar 28, 2019
90a58d5
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
khmakoto Mar 28, 2019
3256fc1
Updating TextField examples.
khmakoto Mar 29, 2019
93442a2
Updating Spinner and Slider examples.
khmakoto Mar 29, 2019
249fade
Removing deprecation detection for Stack.
khmakoto Mar 29, 2019
4434317
Using path.resolve instead of path.join in webpack.serve.config.js.
khmakoto Mar 29, 2019
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
36 changes: 23 additions & 13 deletions apps/vr-tests/src/stories/Stack.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ storiesOf('Stack', module)
))
.addStory('Vertical Stack - Gap', () => (
<Fabric>
<Stack {...defaultProps} gap={10} />
<Stack {...defaultProps} tokens={{ childrenGap: 10 }} />
</Fabric>
))
.addStory('Vertical Stack - Vertically centered', () => (
Expand Down Expand Up @@ -151,7 +151,7 @@ storiesOf('Stack', module)
.addStory(
'Vertical Stack - Item alignments',
() => (
<Stack {...defaultProps} gap={10}>
<Stack {...defaultProps} tokens={{ childrenGap: 10 }}>
<Stack.Item align="auto" className={styles.item}>
Auto-aligned item
</Stack.Item>
Expand All @@ -175,7 +175,7 @@ storiesOf('Stack', module)
{ rtl: true }
)
.addStory('Vertical Stack - Growing items', () => (
<Stack {...defaultProps} gap={10} className={styles.fixedHeight}>
<Stack {...defaultProps} tokens={{ childrenGap: 10 }} className={styles.fixedHeight}>
<Stack.Item grow={3} className={styles.item}>
Grow is 3
</Stack.Item>
Expand All @@ -188,7 +188,7 @@ storiesOf('Stack', module)
</Stack>
))
.addStory('Vertical Stack - Shrinking items', () => (
<Stack {...defaultProps} gap={10} className={styles.fixedHeight}>
<Stack {...defaultProps} tokens={{ childrenGap: 10 }} className={styles.fixedHeight}>
<Stack.Item className={styles.verticalShrinkItem}>1</Stack.Item>
<Stack.Item disableShrink className={styles.verticalShrinkItem}>
2 (does not shrink)
Expand All @@ -202,7 +202,12 @@ storiesOf('Stack', module)
'Vertical Stack - Wrap',
() => (
<Fabric>
<Stack {...defaultProps} gap={'10 0'} wrap className={styles.fixedHeight}>
<Stack
{...defaultProps}
tokens={{ childrenGap: '10 0' }}
wrap
className={styles.fixedHeight}
>
<span className={styles.boxItem}>1</span>
<span className={styles.boxItem}>2</span>
<span className={styles.boxItem}>3</span>
Expand All @@ -225,7 +230,7 @@ storiesOf('Stack', module)
)
.addStory('Vertical Stack - Box shadow around items', () => (
<Fabric>
<Stack {...defaultProps} gap={25}>
<Stack {...defaultProps} tokens={{ childrenGap: 25 }}>
<span className={styles.shadowItem}>1</span>
<span className={styles.shadowItem}>2</span>
<span className={styles.shadowItem}>3</span>
Expand Down Expand Up @@ -261,7 +266,7 @@ storiesOf('Stack', module)
'Horizontal Stack - Gap',
() => (
<Fabric>
<Stack horizontal {...defaultProps} gap={10} />
<Stack horizontal {...defaultProps} tokens={{ childrenGap: 10 }} />
</Fabric>
),
{ rtl: true }
Expand Down Expand Up @@ -308,7 +313,12 @@ storiesOf('Stack', module)
.addStory(
'Horizontal Stack - Item alignments',
() => (
<Stack horizontal {...defaultProps} gap={10} className={styles.fixedHeight}>
<Stack
horizontal
{...defaultProps}
tokens={{ childrenGap: 10 }}
className={styles.fixedHeight}
>
<Stack.Item align="auto" className={styles.item}>
Auto-aligned item
</Stack.Item>
Expand All @@ -332,7 +342,7 @@ storiesOf('Stack', module)
{ rtl: true }
)
.addStory('Horizontal Stack - Growing items', () => (
<Stack horizontal {...defaultProps} gap={10}>
<Stack horizontal {...defaultProps} tokens={{ childrenGap: 10 }}>
<Stack.Item grow={3} className={styles.item}>
Grow is 3
</Stack.Item>
Expand All @@ -345,7 +355,7 @@ storiesOf('Stack', module)
</Stack>
))
.addStory('Horizontal Stack - Shrinking items', () => (
<Stack horizontal {...defaultProps} gap={10}>
<Stack horizontal {...defaultProps} tokens={{ childrenGap: 10 }}>
<Stack.Item className={styles.horizontalShrinkItem}>1</Stack.Item>
<Stack.Item disableShrink className={styles.horizontalShrinkItem}>
2 (does not shrink)
Expand All @@ -361,7 +371,7 @@ storiesOf('Stack', module)
'Horizontal Stack - Wrap',
() => (
<Fabric>
<Stack horizontal {...defaultProps} gap={10} wrap>
<Stack horizontal {...defaultProps} tokens={{ childrenGap: 10 }} wrap>
<span className={styles.boxItem}>1</span>
<span className={styles.boxItem}>2</span>
<span className={styles.boxItem}>3</span>
Expand Down Expand Up @@ -398,7 +408,7 @@ storiesOf('Stack', module)
)
.addStory('Horizontal Stack - Wrap with specified vertical gap', () => (
<Fabric>
<Stack horizontal {...defaultProps} wrap gap={'40 10'}>
<Stack horizontal {...defaultProps} wrap tokens={{ childrenGap: '40 10' }}>
<span className={styles.boxItem}>1</span>
<span className={styles.boxItem}>2</span>
<span className={styles.boxItem}>3</span>
Expand Down Expand Up @@ -433,7 +443,7 @@ storiesOf('Stack', module)
))
.addStory('Horizontal Stack - Box shadow around items', () => (
<Fabric>
<Stack horizontal {...defaultProps} gap={25}>
<Stack horizontal {...defaultProps} tokens={{ childrenGap: 25 }}>
<span className={styles.shadowItem}>1</span>
<span className={styles.shadowItem}>2</span>
<span className={styles.shadowItem}>3</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@uifabric/foundation",
"comment": "Passing styling and tokens to view.",
"type": "patch"
}
],
"packageName": "@uifabric/foundation",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@uifabric/merge-styles",
"comment": "Deleting .api.ts file.",
"type": "patch"
}
],
"packageName": "@uifabric/merge-styles",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@uifabric/react-cards",
"comment": "Card: Improving styling and adding compact Card styling and examples.",
"type": "minor"
}
],
"packageName": "@uifabric/react-cards",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@uifabric/experiments",
"comment": "Updating examples using Stack to use childrenGap token instead of gap prop.",
"type": "patch"
}
],
"packageName": "@uifabric/experiments",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "Stack: Adding margin as a token of StackItem and childrenGap as a token of Stack and updating examples accordingly.",
"type": "minor"
}
],
"packageName": "office-ui-fabric-react",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const ButtonView: IButtonComponent['view'] = props => {
{...buttonProps}
aria-disabled={disabled}
>
<Slots.stack horizontal as="span" gap={8} verticalAlign="center" horizontalAlign="center" verticalFill>
<Slots.stack horizontal as="span" tokens={{ childrenGap: 8 }} verticalAlign="center" horizontalAlign="center" verticalFill>
{icon && <Slots.icon />}
{content && <Slots.content />}
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,20 @@ import { Stack, Text } from 'office-ui-fabric-react';
const menuItems = [{ key: 'a', name: 'Item a' }, { key: 'b', name: 'Item b' }];
const buttonMenu: IMenuButtonProps['menu'] = render => render((MenuType, props) => <MenuType {...props} items={menuItems} />);

const sectionGap = 32;
const headingGap = 16;
const buttonGap = 12;
const tokens = {
sectionStack: {
childrenGap: 32
},
headingStack: {
childrenGap: 16
},
buttonStack: {
childrenGap: 12
}
};

const ButtonStack = (props: { children: JSX.Element[] | JSX.Element }) => (
<Stack horizontal disableShrink gap={buttonGap}>
<Stack horizontal disableShrink tokens={tokens.buttonStack}>
{props.children}
</Stack>
);
Expand All @@ -19,10 +27,10 @@ const ButtonStack = (props: { children: JSX.Element[] | JSX.Element }) => (
export class MenuButtonExample extends React.Component<{}, {}> {
public render(): JSX.Element {
return (
<Stack gap={sectionGap}>
<Stack gap={headingGap} padding={8}>
<Stack tokens={tokens.sectionStack}>
<Stack tokens={tokens.headingStack} padding={8}>
<div>
<Stack gap={buttonGap}>
<Stack tokens={tokens.buttonStack}>
<ButtonStack>
<MenuButton content="Menu button" menu={buttonMenu} />
<MenuButton primary content="Menu primary button" menu={buttonMenu} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ import { Stack } from 'office-ui-fabric-react';
const menuItems = [{ key: 'a', name: 'Item a' }, { key: 'b', name: 'Item b' }];
const buttonMenu: ISplitMenuButtonProps['menu'] = render => render((MenuType, props) => <MenuType {...props} items={menuItems} />);

const sectionGap = 32;
const headingGap = 16;
const buttonGap = 12;
const tokens = {
sectionStack: {
childrenGap: 32
},
headingStack: {
childrenGap: 16
},
buttonStack: {
childrenGap: 12
}
};

const alertClicked = (): void => {
alert('Clicked');
};

const ButtonStack = (props: { children: JSX.Element[] | JSX.Element }) => (
<Stack horizontal disableShrink gap={buttonGap}>
<Stack horizontal disableShrink tokens={tokens.buttonStack}>
{props.children}
</Stack>
);
Expand All @@ -23,10 +31,10 @@ const ButtonStack = (props: { children: JSX.Element[] | JSX.Element }) => (
export class SplitMenuButtonExample extends React.Component<{}, {}> {
public render(): JSX.Element {
return (
<Stack gap={sectionGap}>
<Stack gap={headingGap} padding={8}>
<Stack tokens={tokens.sectionStack}>
<Stack tokens={tokens.headingStack} padding={8}>
<div>
<Stack gap={buttonGap}>
<Stack tokens={tokens.buttonStack}>
<ButtonStack>
<SplitMenuButton icon="Add" content="Default split button" menu={buttonMenu} onClick={alertClicked} />
<SplitMenuButton disabled icon="Add" content="Disabled split button" menu={buttonMenu} onClick={alertClicked} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,24 @@ import * as React from 'react';
import { Button } from '../index';
import { Icon, CommandBar, Stack, Text } from 'office-ui-fabric-react';

const sectionGap = 32;
const headingGap = 16;
const buttonGap = 12;
const tokens = {
sectionStack: {
childrenGap: 32
},
headingStack: {
childrenGap: 16
},
buttonStack: {
childrenGap: 12
}
};

const alertClicked = (): void => {
alert('Clicked');
};

const ButtonStack = (props: { children: JSX.Element[] | JSX.Element }) => (
<Stack horizontal disableShrink gap={buttonGap}>
<Stack horizontal disableShrink tokens={tokens.buttonStack}>
{props.children}
</Stack>
);
Expand All @@ -20,10 +28,10 @@ const ButtonStack = (props: { children: JSX.Element[] | JSX.Element }) => (
export class ButtonExample extends React.Component<{}, {}> {
public render(): JSX.Element {
return (
<Stack gap={sectionGap}>
<Stack gap={headingGap} padding={8}>
<Stack tokens={tokens.sectionStack}>
<Stack tokens={tokens.headingStack} padding={8}>
<div>
<Stack gap={buttonGap}>
<Stack tokens={tokens.buttonStack}>
<ButtonStack>
<Button content="Default button" onClick={alertClicked} />
<Button disabled content="Disabled default button" onClick={alertClicked} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,23 @@ const testTheme = createTheme({
}
});

const sectionGap = 32;
const headingGap = 16;
const buttonGap = 12;
const tokens = {
sectionStack: {
childrenGap: 32
},
headingStack: {
childrenGap: 16
},
buttonStack: {
childrenGap: 12
}
};

const menuItems = [{ key: 'a', name: 'Item a' }, { key: 'b', name: 'Item b' }];
const buttonMenu: IMenuButtonProps['menu'] = render => render((MenuType, props) => <MenuType {...props} items={menuItems} />);

const ButtonStack = (props: { children: JSX.Element[] | JSX.Element }) => (
<Stack horizontal disableShrink gap={buttonGap}>
<Stack horizontal disableShrink tokens={tokens.buttonStack}>
{props.children}
</Stack>
);
Expand All @@ -32,10 +40,10 @@ export class ButtonStylesExample extends React.Component<{}, {}> {
const testClassName = mergeStyles({ color: 'blue' });

return (
<Stack gap={sectionGap}>
<Stack gap={headingGap} padding={8}>
<Stack tokens={tokens.sectionStack}>
<Stack tokens={tokens.headingStack} padding={8}>
<div>
<Stack gap={buttonGap}>
<Stack tokens={tokens.buttonStack}>
<ButtonStack>
<Button icon="PeopleAdd" content="Button Theme: Red Icon and Text" theme={testTheme} />
<Button icon="PeopleAdd" content={{ children: 'Slot Theme: Purple Text', theme: testTheme }} />
Expand Down
Loading