-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(FJS-3): corrections for examples
- Loading branch information
Alexander Rudenko
authored and
Alexander Rudenko
committed
Nov 14, 2021
1 parent
f4b4192
commit f64b1fe
Showing
5 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
packages/react-uikit/src/containers/Section/Section.styles.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,33 @@ | ||
import styled from '@emotion/styled'; | ||
import {getCSSObj} from '../../utils'; | ||
import {THTMLElementProps} from '../../definitions'; | ||
|
||
export type TCWrapProps = THTMLElementProps; | ||
|
||
export const CWrap = styled.div<TCWrapProps>` | ||
${getCSSObj} | ||
`; | ||
|
||
export type TSectionContentProps = THTMLElementProps; | ||
|
||
export const SectionContent = styled.div<TSectionContentProps>` | ||
${getCSSObj} | ||
`; | ||
|
||
export type TCharacterImgWrapProps = THTMLElementProps; | ||
|
||
export const CharacterImgWrap = styled.div<TCharacterImgWrapProps>` | ||
${getCSSObj} | ||
`; | ||
|
||
export type TTitleProps = THTMLElementProps; | ||
|
||
export const Title = styled.h2<TTitleProps>` | ||
${getCSSObj} | ||
`; | ||
|
||
export type TDescriptionProps = THTMLElementProps; | ||
|
||
export const Description = styled.p<TDescriptionProps>` | ||
${getCSSObj} | ||
`; |
32 changes: 32 additions & 0 deletions
32
packages/react-uikit/src/containers/Section/Section.test.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,32 @@ | ||
import * as React from 'react'; | ||
// import {rest} from 'msw'; | ||
// import {setupServer} from 'msw/node'; | ||
import {render, screen} from '@testing-library/react'; | ||
import {Provider} from 'react-redux'; | ||
import {ThemeProvider} from '@emotion/react'; | ||
import store from '../../redux/store'; | ||
import initStore from '../../redux/initStore'; | ||
import theme from '../../theme'; | ||
|
||
import {Section} from './Section'; | ||
|
||
describe('Section', () => { | ||
let target: any; | ||
|
||
beforeEach(() => { | ||
initStore(store); | ||
|
||
render( | ||
<Provider store={store}> | ||
<ThemeProvider theme={theme}> | ||
<Section sectionType="FEATURES">Hello</Section> | ||
</ThemeProvider> | ||
</Provider> | ||
); | ||
target = screen.getByText('Hello'); | ||
}); | ||
|
||
it('renders Initial Render', () => { | ||
expect(!!target).toBe(true); | ||
}); | ||
}); |
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,29 @@ | ||
import React from 'react'; | ||
import { useTheme } from '@emotion/react'; | ||
|
||
import { CWrap, SectionContent, Title, Description } from './Section.styles'; | ||
|
||
export type IProps = TComponentProps; | ||
|
||
export const Section: React.FC<IProps> = (props): JSX.Element => { | ||
const { sizeId, langs, children } = props; | ||
|
||
// @ts-ignore | ||
const theme = { ...useTheme().Section[sectionType] }; | ||
|
||
return ( | ||
<CWrap sizeId={sizeId} theme={theme.cwrap} data-testid={'section__cwrap'}> | ||
<SectionContent sizeId={sizeId} theme={theme.sectioncontent} data-testid={'section__section-content'}> | ||
<Title sizeId={sizeId} theme={theme.title} data-testid={'section__title'}> | ||
{langs.title} | ||
</Title> | ||
<Description sizeId={sizeId} theme={theme.description} data-testid={'section__description'}> | ||
{langs.description} | ||
</Description> | ||
{children} | ||
</SectionContent> | ||
</CWrap> | ||
); | ||
}; | ||
|
||
export default Section; |
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,4 @@ | ||
import Section from './Section'; | ||
|
||
export {Section} from './Section'; | ||
export default Section; |
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,13 @@ | ||
export type TComponentProps<TSize, TLangId, ReactNode> = { | ||
sizeId?: TSize; | ||
langId?: TLangId; | ||
customize?: { | ||
[key: string]: unknown; | ||
}; | ||
children?: ReactNode; | ||
}; | ||
|
||
export type THTMLElementProps<TSize, TTheme> = { | ||
sizeId: TSize; | ||
theme: TTheme; | ||
}; |