-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
348-refactor: Title component refactor (#350)
* feat: 348 - add cva package * feat: 348 - add new size constants * feat: 348 - delete h2 default margin * feat: 348 - add widget-title component * refactor: 348 - Title to WidgetTitle in Parthered * refactor: 348 - Title to WidgetTitle in General * refactor: 348 - add fixme anchor for h1 in main * refactor: 348 - Title to WidgetTitle in About * refactor: 348 - Title to WidgetTitle in About-Home * refactor: 348 - Title to WidgetTitle in About-School * refactor: 348 - Title to WidgetTitle in Alumni * refactor: 348 - Title to WidgetTitle in Angular-Topics * refactor: 348 - Title to WidgetTitle in Certification * refactor: 348 - Title to WidgetTitle in Communication * refactor: 348 - Title to WidgetTitle in Community * refactor: 348 - Title to WidgetTitle in Contribute * refactor: 348 - Title to WidgetTitle in Course-main * refactor: 348 - Title to WidgetTitle in Courses * refactor: 348 - remove unsused styles in courses * refactor: 348 - add widget-title in course-school * refactor: 348 - Title to WidgetTitle in Events * refactor: 348 - Title to WidgetTitle in FAQ * refactor: 348 - Title to WidgetTitle in Main * refactor: 348 - Title to WidgetTitle in Mentoring * refactor: 348 - Title to WidgetTitle in Mentors * refactor: 348 - Title to WidgetTitle in Mentors-wanted * refactor: 348 - Title to WidgetTitle in Merch * refactor: 348 - Title to WidgetTitle in Numbers * refactor: 348 - Title to WidgetTitle in Pictures * refactor: 348 - Title to WidgetTitle in Principles * refactor: 348 - Title to WidgetTitle in Required * refactor: 348 - Title to WidgetTitle in Speakers * refactor: 348 - Title to WidgetTitle in Study-path * refactor: 348 - Title to WidgetTitle in Study-with-us * refactor: 348 - Title to WidgetTitle in Support * refactor: 348 - Title to WidgetTitle in Trainers * refactor: 348 - Title to WidgetTitle in Training-program * refactor: 348 - deletw commented code * refactor: 348 - add vars for tablet font-size * refactor: 348 - Title to WidgetTitle in About-video * refactor: 348 - Add vars for MainTitle * refactor: 348 - reset default h1 margin * refactor: 348 - add MainTitle comp * refactor: 348 - Title to MainTitle in courses/main * refactor: 348 - delete widget main styles for title * refactor: 348 - Title to MainTitle in widgets/main * refactor: 348 - Delete exports in widget-title * refactor: 348 - update vars for widget-title * refactor: 348 - update reset for headiang tag * refactor: 348 - to model and bind classnames * refactor: 348 - delete h1 margin * refactor: 348 - add public api for widget-title * refactor: 348 - update paths /widget-title * refactor: 348 - add model and bind calssnames for main-title * refactor: 348 - delete unused & * refactor: 348 - update classnames name and add to tests * refactor: 348 - add export for cx and add tests for MainTitle * feat: 348 - add public api and update paths * refactor: 348 - delete unused style * refactor: 348 - delete dublicate style * refactor: 348 - delete model in widget-title and update naming for bind classnanes * refactor: 348 - delete model in main-title * refactro: 348 - delete old Title component * refactor: 348 - update import into react * refactor: 348 delete model file for main-title * fix: 348 - fix after review * fix: 348 - off eslint issue --------- Co-authored-by: Dzmitry Yarmoshkin <[email protected]> Co-authored-by: ansivgit <[email protected]>
- Loading branch information
1 parent
0addf43
commit 13ed152
Showing
54 changed files
with
322 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/app/layouts/base-layout/components/partnered/partnered.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,10 @@ li { | |
padding: 0; | ||
} | ||
|
||
h2 { | ||
margin: 0; | ||
} | ||
|
||
figure { | ||
margin: 0; | ||
padding: 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { MainTitle } from './main-title'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.title { | ||
font-size: 96px; | ||
font-weight: 700; | ||
color: $color-black; | ||
text-align: left; | ||
letter-spacing: -0.04em; | ||
|
||
@include media-tablet { | ||
font-size: 60px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { describe, expect, it } from 'vitest'; | ||
import { MainTitle, cx } from './main-title'; | ||
|
||
describe('MainTitle component', () => { | ||
it('renders without crashing', () => { | ||
render(<MainTitle>TestTitle</MainTitle>); | ||
const title = screen.getByText('TestTitle'); | ||
|
||
expect(title).toBeInTheDocument(); | ||
}); | ||
|
||
it('displays h1 tag', () => { | ||
render(<MainTitle />); | ||
const element = screen.getByRole('heading', { level: 1 }); | ||
|
||
expect(element).toBeInTheDocument(); | ||
}); | ||
|
||
it('displays styles correctly', () => { | ||
render(<MainTitle />); | ||
const element = screen.getByRole('heading', { level: 1 }); | ||
|
||
expect(element).toHaveClass(cx('title')); | ||
}); | ||
|
||
it('renders children correctly', () => { | ||
render( | ||
<MainTitle> | ||
<div>Child element</div> | ||
</MainTitle>, | ||
); | ||
|
||
const child = screen.getByText('Child element'); | ||
|
||
expect(child).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { HTMLAttributes } from 'react'; | ||
import { VariantProps, cva } from 'class-variance-authority'; | ||
import classNames from 'classnames/bind'; | ||
|
||
import styles from './main-title.module.scss'; | ||
|
||
type MainTitleProps = HTMLAttributes<HTMLHeadingElement> & VariantProps<typeof mainTitleVariants>; | ||
|
||
export const cx = classNames.bind(styles); | ||
|
||
const mainTitleVariants = cva(cx('title')); | ||
|
||
export const MainTitle = ({ children, className, ...props }: MainTitleProps) => { | ||
return ( | ||
<h1 | ||
{...props} | ||
className={mainTitleVariants({ className })} | ||
> | ||
{children} | ||
</h1> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { WidgetTitle } from './widget-title'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
.title { | ||
font-weight: $font-weight-medium; | ||
letter-spacing: -0.04em; | ||
|
||
&::before { | ||
margin-right: 8px; | ||
color: $color-red; | ||
} | ||
} | ||
|
||
.small { | ||
font-size: 36px; | ||
line-height: 44px; | ||
letter-spacing: 0; | ||
} | ||
|
||
.medium { | ||
font-size: 44px; | ||
line-height: 52px; | ||
|
||
@include media-tablet { | ||
font-size: 36px; | ||
line-height: 44px; | ||
} | ||
} | ||
|
||
.large { | ||
font-size: 52px; | ||
line-height: 64px; | ||
|
||
@include media-tablet { | ||
font-size: 36px; | ||
line-height: 44px; | ||
} | ||
} | ||
|
||
.lines::before { | ||
content: '‖'; | ||
} | ||
|
||
.asterisk::before { | ||
content: '*'; | ||
} |
Oops, something went wrong.