Skip to content

Commit

Permalink
Fix: align right header items (#1720)
Browse files Browse the repository at this point in the history
  • Loading branch information
Onokaev authored May 11, 2022
1 parent f12cf74 commit c9e86ad
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 23 deletions.
10 changes: 9 additions & 1 deletion src/app/views/authentication/Authentication.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@ export const authenticationStyles = (theme: ITheme) => {
alignItems: 'flex-start',
justifyContent: 'start',
marginRight: theme.spacing.s1,
padding: theme.spacing.s1
padding: theme.spacing.s1,
position: 'relative',
top: '1px'
},
spinnerContainer: {
display: 'flex',
flexDirection: 'row'
},
loginProgressLabelStyles: {
root: {
position: 'relative',
top: '6px'
}
}
};
};
2 changes: 1 addition & 1 deletion src/app/views/authentication/Authentication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const Authentication = (props: any) => {
<div className={classes.spinnerContainer}>
<Spinner className={classes.spinner} size={SpinnerSize.medium} />
{!minimised && (
<Label>
<Label styles={{ root: { position: 'relative', top: '8px'}}} >
<FormattedMessage
id={`Signing you ${loginInProgress ? 'in' : 'out'}...`}
/>
Expand Down
6 changes: 6 additions & 0 deletions src/app/views/authentication/profile/Profile.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ export const profileStyles = (theme: ITheme) => {
paddingBottom: 10,
textTransform: 'lowercase'
}
},
profileSpinnerStyles: {
root: {
position: 'relative' as 'relative',
top: '2px'
}
}
}
}
3 changes: 2 additions & 1 deletion src/app/views/authentication/profile/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const Profile = (props: any) => {
const theme = getTheme();
const linkStyles = profileStyles(theme).linkStyles
const personaStyleToken = profileStyles(theme).personaStyleToken;
const profileSpinnerStyles = profileStyles(theme).profileSpinnerStyles;


useEffect(() => {
Expand All @@ -85,7 +86,7 @@ const Profile = (props: any) => {


if (!profile) {
return (<Spinner size={SpinnerSize.medium} />);
return (<Spinner size={SpinnerSize.medium} styles={profileSpinnerStyles} />);
}

const handleSignOut = () => {
Expand Down
16 changes: 11 additions & 5 deletions src/app/views/main-header/MainHeader.styles.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import { ITheme } from '@fluentui/react';

export const mainHeaderStyles = (theme: ITheme, props?: any) => {
export const mainHeaderStyles = (theme: ITheme) => {
return {
rootStyles: {
root: {
background: theme.palette.neutralLighter,
height: 50,
marginBottom: props && props.token ? '0px' : '-9px'
marginBottom: '9px'
}
},
authenticationItemStyles: {
alignItems: 'center',
display: 'flex'
rightItemsStyles: {
root: {
alignItems: 'center'
}
},
feedbackIconAdjustmentStyles: {
position: 'relative' as 'relative',
right: '-6px',
top: '4px'
}
}
}
26 changes: 11 additions & 15 deletions src/app/views/main-header/MainHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ const itemAlignmentsStackTokens: IStackTokens = {
};

export const MainHeader: React.FunctionComponent <MainHeaderProps> = (props: MainHeaderProps) => {
const { authToken, profile } = useSelector(
const { profile } = useSelector(
(state: IRootState) => state
);
const minimised = props.minimised;
const currentTheme = getTheme();
const itemAlignmentStackStyles = mainHeaderStyles(currentTheme, authToken).rootStyles;
const itemStyles = mainHeaderStyles(currentTheme).authenticationItemStyles;
const { rootStyles : itemAlignmentStackStyles, rightItemsStyles,
feedbackIconAdjustmentStyles } = mainHeaderStyles(currentTheme);

return (
<Stack tokens={sectionStackTokens}>
Expand Down Expand Up @@ -71,9 +71,8 @@ export const MainHeader: React.FunctionComponent <MainHeaderProps> = (props: Mai
</Label>
</Stack>

<Stack >
<span style={itemStyles}>
{!profile &&
<Stack horizontal styles={rightItemsStyles}>
{!profile &&
<TooltipHost
content={
<>
Expand All @@ -85,19 +84,16 @@ export const MainHeader: React.FunctionComponent <MainHeaderProps> = (props: Mai
>
<DefaultButton text={translateMessage('Sample Tenant')} checked={true} style={{border: 'none'}}/>
</TooltipHost>
}
{profile &&
}
{profile &&
<DefaultButton text={`${profile.tenant} Tenant`} checked={true} style={{border: 'none', cursor: 'default'}}
/>
}
<FeedbackButton />
<Settings />
<Authentication />
</span>
<span style={itemStyles}></span>
}
<span style={feedbackIconAdjustmentStyles}> <FeedbackButton /> </span>
<Settings />
<Authentication />
</Stack>
</Stack>
</Stack>
);
};

0 comments on commit c9e86ad

Please sign in to comment.