Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
chore: rename helpers in library component
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirved64 committed Oct 11, 2023
1 parent abb47af commit 52ae3c6
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 45 deletions.
34 changes: 17 additions & 17 deletions landing/fragments/landing-library/src/cards/card/card.component.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import React from 'react'
import { FC } from 'react'
import React from 'react'
import { FC } from 'react'

import { Condition } from '@ui/condition/src'
import { ArrowRightIcon } from '@ui/icons/src'
import { Box } from '@ui/layout/src'
import { Column } from '@ui/layout/src'
import { Layout } from '@ui/layout/src'
import { Row } from '@ui/layout/src'
import { Text } from '@ui/text/src'
import { useWindowWidth } from '@ui/utils/src'
import { useHover } from '@ui/utils/src'
import { useActive } from '@ui/utils/src'
import { Condition } from '@ui/condition/src'
import { ArrowRightIcon } from '@ui/icons/src'
import { Box } from '@ui/layout/src'
import { Column } from '@ui/layout/src'
import { Layout } from '@ui/layout/src'
import { Row } from '@ui/layout/src'
import { Text } from '@ui/text/src'
import { useWindowWidth } from '@ui/utils/src'
import { useHover } from '@ui/utils/src'
import { useActive } from '@ui/utils/src'

import { CardKeys } from './card.interfaces'
import { getColorText } from '../../helpers'
import { getColorIcon } from '../../helpers'
import { CardKeys } from './card.interfaces'
import { changeColorText } from '../../helpers'
import { changeColorIcon } from '../../helpers'

export const Card: FC<CardKeys> = ({ title, technologiesList, description }) => {
const { isMobile } = useWindowWidth()
Expand All @@ -26,7 +26,7 @@ export const Card: FC<CardKeys> = ({ title, technologiesList, description }) =>
<Column maxWidth={['100%', 785]}>
<Box>
<Text
color={getColorText(hover, active)}
color={changeColorText(hover, active)}
fontSize={['regular', 'giant']}
lineHeight={['standard', 'small']}
>
Expand Down Expand Up @@ -81,7 +81,7 @@ export const Card: FC<CardKeys> = ({ title, technologiesList, description }) =>
<Layout flexBasis={20} flexGrow='1' />

<Box width={56} height={56} justifyContent='center' alignItems='center'>
<ArrowRightIcon width={21} height={42} color={getColorIcon(hover, active)} />
<ArrowRightIcon width={21} height={42} color={changeColorIcon(hover, active)} />
</Box>
</Condition>
</Box>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const getColorIcon = (hover: boolean, active: boolean): string => {
export const changeColorIcon = (hover: boolean, active: boolean): string => {
if (hover) return 'accentPurple'
if (active) return 'ghostPurple'
return 'darkPurple'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export const getColorSearchIcon = (hover: boolean, focus: boolean, searchQuery: string): string => {
export const changeColorSearchIcon = (
hover: boolean,
focus: boolean,
searchQuery: string
): string => {
if (hover) return 'darkPurpleTransparent'
if (focus) return 'darkestPurple'
if (searchQuery) return 'darkestPurple'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export const getColorSearchText = (hover: boolean, focus: boolean, searchQuery: string): string => {
export const changeColorSearchText = (
hover: boolean,
focus: boolean,
searchQuery: string
): string => {
if (hover) return 'darkPurpleTransparent'
if (focus) return 'darkestPurple'
if (searchQuery) return 'darkestPurple'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const getColorText = (hover: boolean, active: boolean): string => {
export const changeColorText = (hover: boolean, active: boolean): string => {
if (hover) return 'accentPurple'
if (active) return 'ghostPurple'
return 'darkPurple'
Expand Down
8 changes: 4 additions & 4 deletions landing/fragments/landing-library/src/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './get-color-text'
export * from './get-color-icon'
export * from './get-color-search-icon'
export * from './get-color-search-text'
export * from './change-color-text'
export * from './change-color-icon'
export * from './change-color-search-icon'
export * from './change-color-search-text'
40 changes: 20 additions & 20 deletions landing/fragments/landing-library/src/library.component.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import React from 'react'
import { FormattedMessage } from 'react-intl'
import { useState } from 'react'
import { useIntl } from 'react-intl'

import { Divider } from '@ui/divider'
import { SearchIcon } from '@ui/icons'
import { Input } from '@ui/input'
import { Box } from '@ui/layout'
import { Column } from '@ui/layout'
import { Layout } from '@ui/layout'
import { Text } from '@ui/text'
import { useFocus } from '@ui/utils'
import { useHover } from '@ui/utils'

import { SearchButton } from './search'
import { getColorSearchIcon } from './helpers'
import { getColorSearchText } from './helpers'
import React from 'react'
import { FormattedMessage } from 'react-intl'
import { useState } from 'react'
import { useIntl } from 'react-intl'

import { Divider } from '@ui/divider'
import { SearchIcon } from '@ui/icons'
import { Input } from '@ui/input'
import { Box } from '@ui/layout'
import { Column } from '@ui/layout'
import { Layout } from '@ui/layout'
import { Text } from '@ui/text'
import { useFocus } from '@ui/utils'
import { useHover } from '@ui/utils'

import { SearchButton } from './search'
import { changeColorSearchIcon } from './helpers'
import { changeColorSearchText } from './helpers'

export const LibraryBanner = () => {
const { hover, hoverProps } = useHover()
Expand Down Expand Up @@ -70,15 +70,15 @@ export const LibraryBanner = () => {
<SearchIcon
width={20}
height={20}
color={getColorSearchIcon(hover, focus, searchQuery)}
color={changeColorSearchIcon(hover, focus, searchQuery)}
/>
}
widthIcon={20}
heightIcon={20}
filled={searchQuery}
addon={searchQuery ? <SearchButton /> : null}
placeholder={intl.formatMessage({ id: 'library.search.placeholder' })}
color={getColorSearchText(hover, focus, searchQuery)}
color={changeColorSearchText(hover, focus, searchQuery)}
/>
</Box>

Expand Down

0 comments on commit 52ae3c6

Please sign in to comment.