Skip to content

Commit

Permalink
[LOOM-1313][BpkSectionHeader] Class2 Fixes (#3380)
Browse files Browse the repository at this point in the history
* trial with spans

* set textStyle

* set as h2 tag

---------

Co-authored-by: metalix2 <matthewr@skyscanner.net>
  • Loading branch information
metalix2 and metalix2 authored Apr 23, 2024
1 parent eba7bf6 commit af5e312
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
}

&__title {
@include typography.bpk-text;
@include typography.bpk-heading-2;

@include breakpoints.bpk-breakpoint-mobile {
Expand Down
19 changes: 6 additions & 13 deletions packages/bpk-component-section-header/src/BpkSectionHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,12 @@ const BpkSectionHeader = ({
`bpk-section-header__title-description--${type}`,
)}
>
<BpkText
tagName="h2"
// TODO: className to be removed
// eslint-disable-next-line @skyscanner/rules/forbid-component-props
className={getClassName('bpk-section-header__title')}
>
{title}
</BpkText>
{description && <BpkText
// TODO: className to be removed
// eslint-disable-next-line @skyscanner/rules/forbid-component-props
className={getClassName('bpk-section-header__description')}>{description}
</BpkText>}
<h2 className={getClassName('bpk-section-header__title')}>{title}</h2>
{description && (
<span className={getClassName('bpk-section-header__description')}>
<BpkText>{description}</BpkText>
</span>
)}
</div>
{button}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports[`BpkSectionHeader should render correctly 1`] = `
class="bpk-section-header__title-description bpk-section-header__title-description--default"
>
<h2
class="bpk-text bpk-text--body-default bpk-section-header__title"
class="bpk-section-header__title"
>
Section title
</h2>
Expand All @@ -27,14 +27,18 @@ exports[`BpkSectionHeader should render correctly with "type" prop 1`] = `
class="bpk-section-header__title-description bpk-section-header__title-description--on-dark"
>
<h2
class="bpk-text bpk-text--body-default bpk-section-header__title"
class="bpk-section-header__title"
>
Section title
</h2>
<span
class="bpk-text bpk-text--body-default bpk-section-header__description"
class="bpk-section-header__description"
>
Section title description
<span
class="bpk-text bpk-text--body-default"
>
Section title description
</span>
</span>
</div>
<button
Expand All @@ -56,14 +60,18 @@ exports[`BpkSectionHeader should render correctly with a "description" prop 1`]
class="bpk-section-header__title-description bpk-section-header__title-description--default"
>
<h2
class="bpk-text bpk-text--body-default bpk-section-header__title"
class="bpk-section-header__title"
>
Section title
</h2>
<span
class="bpk-text bpk-text--body-default bpk-section-header__description"
class="bpk-section-header__description"
>
Section title description
<span
class="bpk-text bpk-text--body-default"
>
Section title description
</span>
</span>
</div>
</div>
Expand All @@ -79,14 +87,18 @@ exports[`BpkSectionHeader should render correctly with an "button" prop 1`] = `
class="bpk-section-header__title-description bpk-section-header__title-description--default"
>
<h2
class="bpk-text bpk-text--body-default bpk-section-header__title"
class="bpk-section-header__title"
>
Section title
</h2>
<span
class="bpk-text bpk-text--body-default bpk-section-header__description"
class="bpk-section-header__description"
>
Section title description
<span
class="bpk-text bpk-text--body-default"
>
Section title description
</span>
</span>
</div>
<button
Expand Down

0 comments on commit af5e312

Please sign in to comment.