Skip to content

Commit

Permalink
feat: relocate TitleBlock component from web
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzhastin-Nikita authored and the-homeless-god committed May 26, 2022
1 parent 3a5760b commit 292676b
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/components/atoms/TitleBlock/TitleBlock.styles.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@import 'src/scss/mixins';

.heading {
width: 100%;
height: 70px;
display: flex;
flex-wrap: wrap;

@include desktop {
margin-top: 80px;
}

@include devices {
margin-top: 20px;
}
}

.text {
font-family: $font-lato;
font-size: 48px;
font-style: normal;
font-weight: 700;
line-height: 58px;
letter-spacing: 0;
text-align: left;
}

.text-color {
color: $color-base;
}
40 changes: 40 additions & 0 deletions src/components/atoms/TitleBlock/TitleBlock.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react'

import cx from 'classnames'

import css from './TitleBlock.styles.module.scss'

export type TitleBlockProps = {
simpleText?: string
highlightText?: string
className?: string
simpleClassName?: string
highlightClassName?: string
}

export const TitleBlock = ({
simpleText,
highlightText,
className,
simpleClassName,
highlightClassName
}: TitleBlockProps) => {
if (!simpleText && !highlightText) {
return null
}

const getSimpleText = () => {
if (simpleText) {
return <>{simpleText}&nbsp;</>
}

return simpleText
}

return (
<div className={cx(css.heading, className)}>
{simpleText && <span className={cx(css.text, simpleClassName)}>{getSimpleText()}</span>}
{highlightText && <span className={cx(css.text, css.textColor, highlightClassName)}>{highlightText}</span>}
</div>
)
}
1 change: 1 addition & 0 deletions src/components/atoms/TitleBlock/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './TitleBlock'

0 comments on commit 292676b

Please sign in to comment.