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

refactor(TitleBar) : Add Left Title Property to TitleBar #1187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions packages/Layout/header/src/Title/Title.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ Default.args = {
title: 'Toolkit Axa',
subtitle: 'Info complémentaire',
isSticky: true,
leftTitle: (
<a className="af-title-bar__link" href="#return" title="Retour">
<i className="glyphicon glyphicon-chevron-left" />
</a>
),
};
Default.argTypes = {
toggleMenu: { action: 'onToggle' },
Expand Down
10 changes: 9 additions & 1 deletion packages/Layout/header/src/Title/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Props = {
className?: string;
classModifier?: string;
isSticky?: boolean;
leftTitle?: ReactNode;
};
const Title = ({
title,
Expand All @@ -22,6 +23,7 @@ const Title = ({
className,
classModifier,
isSticky = true,
leftTitle,
}: Props) => {
if (isSticky) {
// eslint-disable-next-line no-param-reassign
Expand All @@ -38,7 +40,10 @@ const Title = ({
);
return (
<div className={componentClassName}>
<div className={`container ${defaultClassName}__wrapper`}>
<div
className={`container ${defaultClassName}__wrapper${
leftTitle ? '-titleLeft' : ''
}`}>
{!!toggleMenu && (
<div className="burger-container">
<ToggleButton idControl="mainmenu">
Expand All @@ -52,6 +57,9 @@ const Title = ({
</ToggleButton>
</div>
)}
{leftTitle ? (
<div className="left-title-container">{leftTitle}</div>
) : null}
<h1 className={`${defaultClassName}__title`}>
{title}
{subtitle && (
Expand Down
21 changes: 20 additions & 1 deletion packages/Layout/header/src/Title/title-bar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
background: $brand-primary;
color: $white;
overflow: auto;
padding: 0.66rem 0;
padding: 12.66rem 0;
margin-bottom: 2rem;

&--sticky {
Expand Down Expand Up @@ -96,13 +96,32 @@
flex-wrap: wrap;
justify-content: space-between;
width: 100%;

&-titleLeft {
display: flex;
gap: 1rem;
margin-left: inherit;
align-self: center;
}
}
}

.left-title-container {
display: flex;
align-self: center;
}

.burger-container {
display: none;
}
}

@include media-breakpoint-down(xs) {
.left-title-container {
display: none;
}
}

@include media-breakpoint-up(md) {
.af-title-bar {
padding: 0.66rem 0;
Expand Down
Loading