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(Header): Change title to HeaderTitle #1184

Merged
merged 1 commit into from
Jul 17, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import { Meta } from '@storybook/react';
import Action from '@axa-fr/react-toolkit-action';
import Title from './Title';
import HeaderTitle from './HeaderTitle';
import readme from '../../README.md';

export default {
title: 'Structure/Title Bar',
component: Title,
title: 'Structure/Header/HeaderTitle',
component: HeaderTitle,
parameters: {
readme: {
sidebar: readme,
Expand All @@ -31,7 +31,7 @@ const actions = [
},
];

export const Default = (args) => <Title {...args} />;
export const Default = (args) => <HeaderTitle {...args} />;
Default.args = {
title: 'Toolkit Axa',
subtitle: 'Info complémentaire',
Expand All @@ -42,7 +42,7 @@ Default.argTypes = {
};

export const Complex = (args) => (
<Title {...args}>
<HeaderTitle {...args}>
<div className="af-title-bar__actions">
<a className="af-title-bar__link" href="#lien" title="lien titlebar">
lien titlebar
Expand All @@ -59,7 +59,7 @@ export const Complex = (args) => (
/>
))}
</div>
</Title>
</HeaderTitle>
);
Complex.args = {
...Default.args,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Props = {
classModifier?: string;
isSticky?: boolean;
};
const Title = ({
const HeaderTitle = ({
title,
subtitle,
children,
Expand Down Expand Up @@ -64,4 +64,4 @@ const Title = ({
);
};

export default Title;
export default HeaderTitle;
1 change: 1 addition & 0 deletions packages/Layout/header/src/HeaderTitle/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as HeaderTitle } from './HeaderTitle';
4 changes: 2 additions & 2 deletions packages/Layout/header/src/MenuTitleWrapper.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { Meta } from '@storybook/react';
import { NavBar, NavBarItem } from './NavBar';
import { Title } from './Title';
import { HeaderTitle } from './HeaderTitle';

export default {
title: 'Structure/Header/MenuTitleWrapper',
Expand Down Expand Up @@ -151,7 +151,7 @@ const MenuTitleWrapper = () => {
/>
</NavBarItem>
</NavBar>
<Title
<HeaderTitle
title="Toolkit Axa"
subtitle="Sous titre"
toggleMenu={handleClick}
Expand Down
1 change: 0 additions & 1 deletion packages/Layout/header/src/Title/index.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import { render } from '@testing-library/react';
import { Title } from '../Title/index';
import { HeaderTitle } from '../HeaderTitle/index';

describe('<Title>', () => {
it('renders Title correctly', () => {
describe('<HeaderTitle>', () => {
it('renders HeaderTitle correctly', () => {
const { asFragment } = render(
<Title
<HeaderTitle
title="Toolkit Axa"
subtitle="Info complémentaire"
toggleMenu={() => null}
Expand All @@ -14,16 +14,16 @@ describe('<Title>', () => {
expect(asFragment()).toMatchSnapshot();
});

it('renders Title correctly without menu', () => {
it('renders HeaderTitle correctly without menu', () => {
const { asFragment } = render(
<Title title="Toolkit Axa" subtitle="Info complémentaire" />
<HeaderTitle title="Toolkit Axa" subtitle="Info complémentaire" />
);
expect(asFragment()).toMatchSnapshot();
});

it('renders Title with classModifier', () => {
it('renders HeaderTitle with classModifier', () => {
const { asFragment } = render(
<Title
<HeaderTitle
title="Toolkit Axa"
subtitle="Info complémentaire"
classModifier="test"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<Title> renders Title correctly 1`] = `
exports[`<HeaderTitle> renders HeaderTitle correctly 1`] = `
<DocumentFragment>
<div
class="af-title-bar af-title-bar--sticky"
Expand Down Expand Up @@ -41,7 +41,7 @@ exports[`<Title> renders Title correctly 1`] = `
</DocumentFragment>
`;

exports[`<Title> renders Title correctly without menu 1`] = `
exports[`<HeaderTitle> renders HeaderTitle correctly without menu 1`] = `
<DocumentFragment>
<div
class="af-title-bar af-title-bar--sticky"
Expand All @@ -64,7 +64,7 @@ exports[`<Title> renders Title correctly without menu 1`] = `
</DocumentFragment>
`;

exports[`<Title> renders Title with classModifier 1`] = `
exports[`<HeaderTitle> renders HeaderTitle with classModifier 1`] = `
<DocumentFragment>
<div
class="af-title-bar af-title-bar--test af-title-bar--sticky"
Expand Down
2 changes: 1 addition & 1 deletion packages/Layout/header/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ export {
NavBarItemBase,
NavBarItemLink,
} from './NavBar';
export { Title } from './Title';
export { HeaderTitle } from './HeaderTitle';
export { default as ToggleButton } from './ToggleButton';
export { User } from './User';
2 changes: 1 addition & 1 deletion packages/all/src/layout-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export {
NavBarItem,
NavBarItemBase,
NavBarItemLink,
Title as HeaderTitle,
HeaderTitle,
ToggleButton,
User,
} from '@axa-fr/react-toolkit-layout-header';
Loading