Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c6375df
Pulsing beacon straight from Coachmark, just smaller, needs perf impr
lynamemi Apr 2, 2018
ae0330c
timing like coachmark
lynamemi Apr 2, 2018
6594e6e
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
lynamemi Apr 3, 2018
47322e9
Only render the beacon if necessary
lynamemi Apr 3, 2018
939b111
More consistent classname
lynamemi Apr 3, 2018
85b8a8e
More descriptive prop
lynamemi Apr 3, 2018
ef56748
More aligned icon positioning, ready for animation to come from styling
lynamemi Apr 3, 2018
f512b49
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
lynamemi Apr 5, 2018
830dbfa
Added animation from styling package
lynamemi Apr 5, 2018
67012f2
Removed comma
lynamemi Apr 5, 2018
6825f5e
Added change file
lynamemi Apr 5, 2018
d39777b
Updated snaphots
lynamemi Apr 5, 2018
2b10ed2
Added test for animation
lynamemi Apr 5, 2018
fdce482
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
lynamemi Apr 12, 2018
f11b3be
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
lynamemi Apr 12, 2018
6bfa48a
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
lynamemi Apr 13, 2018
a9a585c
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
lynamemi Apr 13, 2018
adab2d1
Double pulse and single pulse
lynamemi Apr 13, 2018
34a7662
Animation polish + content fade and slide
lynamemi Apr 13, 2018
8cfafdc
Updated snapshot and removed unused import
lynamemi Apr 13, 2018
c9721b3
Added styling change file
lynamemi Apr 13, 2018
7f970f6
Add missing semicolon
lynamemi Apr 13, 2018
7cf1078
Lower zIndex and fix HC mode alignment
lynamemi Apr 16, 2018
c11b9cd
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
lynamemi Apr 16, 2018
fd41b49
Updated snapshot
lynamemi Apr 16, 2018
e346cf9
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
lynamemi Apr 17, 2018
8509ff9
Switch default beacon colors to theme colors
lynamemi Apr 17, 2018
295a03b
Merge branch 'master' into activity-item-animation
lynamemi Apr 17, 2018
6570a10
Setting default beacon colors from the theme in styling instead of de…
lynamemi Apr 17, 2018
d35b27f
Merge branch 'activity-item-animation' of https://github.com/lynamemi…
lynamemi Apr 17, 2018
57aa539
Merge branch 'master' of https://github.com/OfficeDev/office-ui-fabri…
lynamemi Apr 18, 2018
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "PulsingBeaconAnimationStyles: Distinguish between single and double pulse.",
"packageName": "@uifabric/styling",
"type": "minor"
}
],
"packageName": "@uifabric/styling",
"email": "lynam.emily@gmail.com"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "ActivityItem: Added the pulsing beacon animation for the compact size.",
"type": "minor"
}
],
"packageName": "office-ui-fabric-react",
"email": "lynam.emily@gmail.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface IActivityItemClassNames {
activityTypeIcon?: string;
commentText?: string;
timeStamp?: string;
pulsingBeacon?: string;
}

export const getClassNames = memoizeFunction((
Expand All @@ -32,6 +33,11 @@ export const getClassNames = memoizeFunction((
isCompact && styles.isCompactRoot
),

pulsingBeacon: mergeStyles(
'ms-ActivityItem-pulsingBeacon',
styles.pulsingBeacon
),

personaContainer: mergeStyles(
'ms-ActivityItem-personaContainer',
styles.personaContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,66 @@ import {
concatStyleSets,
ITheme,
getTheme,
HighContrastSelector
HighContrastSelector,
keyframes,
PulsingBeaconAnimationStyles
} from '../../Styling';
import {
memoizeFunction
} from '../../Utilities';
import { IActivityItemStyles } from './ActivityItem.types';
import { IActivityItemStyles, IActivityItemProps } from './ActivityItem.types';

const DEFAULT_PERSONA_SIZE = '32px';
const COMPACT_PERSONA_SIZE = '16px';
const DEFAULT_ICON_SIZE = '16px';
const COMPACT_ICON_SIZE = '13px';
const ANIMATION_INNER_DIMENSION = '4px';
const ANIMATION_OUTER_DIMENSION = '28px';
const ANIMATION_BORDER_WIDTH = '4px';

export const getStyles = memoizeFunction((
props: IActivityItemProps,
theme: ITheme = getTheme(),
customStyles?: IActivityItemStyles
): IActivityItemStyles => {

const continuousPulse = PulsingBeaconAnimationStyles.continuousPulseAnimationSingle(
props.beaconColorOne ? props.beaconColorOne : theme.palette.themePrimary,
props.beaconColorTwo ? props.beaconColorTwo : theme.palette.themeTertiary,
ANIMATION_INNER_DIMENSION,
ANIMATION_OUTER_DIMENSION,
ANIMATION_BORDER_WIDTH
);

const fadeIn: string = keyframes({
from: { opacity: 0, },
to: { opacity: 1, }
});

const slideIn: string = keyframes({
from: { transform: 'translateX(-10px)' },
to: { transform: 'translateX(0)' }
});

const continuousPulseAnimation = {
animationName: continuousPulse,
animationIterationCount: '1',
animationDuration: '.8s',
zIndex: 1
};

const slideInAnimation = {
animationName: slideIn,
animationIterationCount: '1',
animationDuration: '.5s',
};

const fadeInAnimation = {
animationName: fadeIn,
animationIterationCount: '1',
animationDuration: '.5s',
};

const ActivityItemStyles: IActivityItemStyles = {

root: [
Expand All @@ -29,7 +73,23 @@ export const getStyles = memoizeFunction((
lineHeight: '17px',
boxSizing: 'border-box',
color: theme.palette.neutralSecondary
}
},
(props.isCompact && props.animateBeaconSignal) && fadeInAnimation
],

pulsingBeacon: [
{
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
width: '0px',
height: '0px',
borderRadius: '225px',
borderStyle: 'solid',
opacity: 0
},
(props.isCompact && props.animateBeaconSignal) && continuousPulseAnimation
],

isCompactRoot: {
Expand Down Expand Up @@ -63,19 +123,24 @@ export const getStyles = memoizeFunction((

isCompactIcon: {
height: COMPACT_PERSONA_SIZE,
minWidth: COMPACT_PERSONA_SIZE,
fontSize: COMPACT_ICON_SIZE,
lineHeight: COMPACT_ICON_SIZE,
color: theme.palette.themePrimary,
marginTop: '1px',
position: 'relative',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
selectors: {
'.ms-Persona-imageArea': {
marginTop: '-2px',
margin: '-2px 0 0 -2px',
border: '2px solid' + theme.palette.white,
borderRadius: '50%',
selectors: {
[HighContrastSelector]: {
border: 'none',
marginTop: '0'
margin: '0'
}
}
}
Expand All @@ -101,9 +166,12 @@ export const getStyles = memoizeFunction((
overflow: 'visible'
},

activityContent: {
padding: '0 8px'
},
activityContent: [
{
padding: '0 8px'
},
(props.isCompact && props.animateBeaconSignal) && slideInAnimation
],

activityText: {
display: 'inline'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,17 @@ describe('ActivityItem', () => {
expect(tree).toMatchSnapshot();
});

it('renders compact with animation correctly', () => {
const component = renderer.create(
<ActivityItem
{ ...defaultProps }
activityPersonas={ [defaultPersonaProps[0]] }
isCompact={ true }
animateBeaconSignal={ true }
/>
);
const tree = component.toJSON();
expect(tree).toMatchSnapshot();
});

});
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/* tslint:disable */
import * as React from 'react';
/* tslint:enable */

import { DefaultPalette } from '../../Styling';
import { BaseComponent } from '../../Utilities';
import { IActivityItemProps, IActivityItemStyles } from './ActivityItem.types';
import { IActivityItemClassNames, getClassNames } from './ActivityItem.classNames';
import { getStyles } from './ActivityItem.styles';
import { PersonaSize, PersonaCoin, IPersonaSharedProps } from '../../Persona';

export class ActivityItem extends BaseComponent<IActivityItemProps, {}> {

constructor(props: IActivityItemProps) {
super(props);
}
Expand All @@ -19,7 +20,9 @@ export class ActivityItem extends BaseComponent<IActivityItemProps, {}> {
onRenderActivityDescription = this._onRenderActivityDescription,
onRenderComments = this._onRenderComments,
onRenderTimeStamp = this._onRenderTimeStamp,
styles: customStyles
styles: customStyles,
animateBeaconSignal,
isCompact
} = this.props;

const classNames = this._getClassNames(this.props);
Expand All @@ -29,6 +32,9 @@ export class ActivityItem extends BaseComponent<IActivityItemProps, {}> {

{ (this.props.activityPersonas || this.props.activityIcon || this.props.onRenderIcon) &&
<div className={ classNames.activityTypeIcon }>
{ animateBeaconSignal && isCompact &&
<div className={ classNames.pulsingBeacon } />
}
{ onRenderIcon(this.props) }
</div>
}
Expand Down Expand Up @@ -122,6 +128,6 @@ export class ActivityItem extends BaseComponent<IActivityItemProps, {}> {
}

private _getClassNames(props: IActivityItemProps): IActivityItemClassNames {
return getClassNames(getStyles(undefined, props.styles), props.className!, props.activityPersonas!, props.isCompact!);
return getClassNames(getStyles(props, undefined, props.styles), props.className!, props.activityPersonas!, props.isCompact!);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,23 @@ export interface IActivityItemProps extends React.AllHTMLAttributes<HTMLElement>
* Element shown as a timestamp on this activity. If not included, no timestamp is shown.
*/
timeStamp?: string | React.ReactNode[] | React.ReactNode;

/**
* Beacon color one
*/
beaconColorOne?: string;

/**
* Beacon color two
*/
beaconColorTwo?: string;

/**
* Enables/Disables the beacon that radiates
* from the center of the center of the activity icon. Signals an activity has started.
* @default false
*/
animateBeaconSignal?: boolean;
}

export interface IActivityItemStyles {
Expand All @@ -84,6 +101,11 @@ export interface IActivityItemStyles {
*/
root?: IStyle;

/**
* Styles applied to the root activity item container.
*/
pulsingBeacon?: IStyle;

/**
* Styles applied to the main container of the activity's description.
*/
Expand Down
Loading