generated from yandex-praktikum/client-server-template-with-vite
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Добавил компонент заголовка PageTitle, заголовок
с подложкой переименовал в СustomPageTitle - Добавил tag main в компонент PublicLayout
- Loading branch information
Showing
6 changed files
with
163 additions
and
106 deletions.
There are no files selected for viewing
120 changes: 120 additions & 0 deletions
120
packages/client/src/components/ui/CustomPageTitle/CustomPageTitle.scss
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,120 @@ | ||
@import '../../../scss/vars'; | ||
|
||
@mixin decorParentPosition { | ||
position: absolute; | ||
top: -$border-width; | ||
left: -$border-width; | ||
right: -$border-width; | ||
bottom: -$border-width; | ||
} | ||
|
||
$bg-color: #1e1e1e; | ||
$border-width: 7px; | ||
$border-gradient: linear-gradient(45deg, #414243, #7f7f7f) top left, | ||
linear-gradient(135deg, #7f7f7f, #414243) top right, | ||
linear-gradient(225deg, #414243, #414042) bottom right, | ||
linear-gradient(315deg, #414042, #414243) bottom left; | ||
$border-radius: 24px; | ||
$block-width: 350px; | ||
$outline-color: #101010; | ||
|
||
.custom-page-title { | ||
position: relative; | ||
display: flex; | ||
justify-content: center; | ||
|
||
&__block { | ||
position: relative; | ||
display: block; | ||
border-radius: $border-radius; | ||
z-index: 0; | ||
width: $block-width; | ||
max-width: 100%; | ||
} | ||
|
||
&__border { | ||
@mixin borderDecorSettings($top, $bottom) { | ||
content: ''; | ||
position: absolute; | ||
top: $top; | ||
bottom: $bottom; | ||
left: 0; | ||
right: 0; | ||
height: $border-width; | ||
|
||
background: url('@/assets/images/svg/title-decor.svg') no-repeat center | ||
center; | ||
background-size: contain; | ||
} | ||
|
||
@include decorParentPosition(); | ||
|
||
border-radius: $border-radius; | ||
background: $border-gradient; | ||
background-size: 50% 50%; | ||
background-repeat: no-repeat; | ||
z-index: -1; | ||
padding: 10px; | ||
outline: 3px solid $outline-color; | ||
|
||
&::before { | ||
@include borderDecorSettings(0, 'auto'); | ||
} | ||
|
||
&::after { | ||
@include borderDecorSettings('auto', 0); | ||
|
||
transform: rotate(180deg); | ||
} | ||
} | ||
|
||
&__screws { | ||
@mixin screwSettings($left, $right) { | ||
content: ''; | ||
position: absolute; | ||
left: $left; | ||
right: $right; | ||
top: 50%; | ||
width: 33px; | ||
height: 41px; | ||
z-index: -2; | ||
} | ||
|
||
@include decorParentPosition(); | ||
|
||
&::before { | ||
@include screwSettings(0, 'auto'); | ||
|
||
transform: translate(calc(-100%), -50%) rotate(180deg); | ||
background: url('@/assets/images/svg/title-decor--bolt.svg') no-repeat | ||
center center; | ||
background-size: contain; | ||
} | ||
|
||
&::after { | ||
@include screwSettings('auto', 0); | ||
|
||
transform: translate(calc(100%), -50%); | ||
background: url('@/assets/images/svg/title-decor--bolt.svg') no-repeat | ||
center center; | ||
background-size: contain; | ||
} | ||
} | ||
|
||
&__content { | ||
border-radius: calc($border-radius - 6px); | ||
border: 1px solid $primary-color; | ||
background-color: $bg-color; | ||
text-align: center; | ||
color: $text-color; | ||
padding: 12px; | ||
|
||
& > * { | ||
font-size: 24px; | ||
font-weight: 700; | ||
letter-spacing: 1px; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/client/src/components/ui/CustomPageTitle/CustomPageTitle.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import './CustomPageTitle.scss' | ||
import React from 'react' | ||
|
||
type PageTitlePropsType = { | ||
text: string | ||
className?: string | ||
tagName?: string | ||
} | ||
|
||
type DynamicTagElementPropsType = { | ||
tagName: string | ||
children: React.ReactNode | ||
} | ||
|
||
export const CustomPageTitle = (props: PageTitlePropsType) => { | ||
const { text, className = '', tagName = 'h2' } = props | ||
const DynamicTagElement = ({ | ||
tagName, | ||
children, | ||
}: DynamicTagElementPropsType) => React.createElement(tagName, null, children) | ||
|
||
return ( | ||
<div className={`custom-page-title ${className}`}> | ||
<div className="custom-page-title__block"> | ||
<div className="custom-page-title__border"></div> | ||
<div className="custom-page-title__screws"></div> | ||
|
||
<div className="custom-page-title__content"> | ||
<DynamicTagElement tagName={tagName}>{text}</DynamicTagElement> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} |
104 changes: 5 additions & 99 deletions
104
packages/client/src/components/ui/PageTitle/PageTitle.scss
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