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

feat/landing-5 #20

Merged
merged 6 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
278 changes: 272 additions & 6 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const CardDetails: FC<CardDetailsProps> = ({ info, quantity, desc }) => (
</Box>
<Box width={64} height={64} display={['flex', 'none']}>
<Layout flexBasis={65} flexShrink='0' />
<ImageBlock src='/courses-icon-sphere.png' />
<ImageBlock src='/sphere-pink.png' />
</Box>
</Box>
</Column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ const Cards = () => {
/>
<Layout flexBasis={[20, 40]} />
<Box display={['flex', 'none']}>
<Swiper spaceBetween={10} slidesPerView={1.22} slidesOffsetAfter={-10}>
<Swiper
spaceBetween={10}
slidesPerView={1.22}
slidesOffsetAfter={-10}
className='CardSlider'
>
<SwiperSlide>
<CardShort
category={intl.formatMessage({ id: '/', defaultMessage: 'Учебный материал' })}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const Process = () => {
quantity={intl.formatMessage({ id: '/', defaultMessage: '5' })}
title={intl.formatMessage({ id: '/', defaultMessage: 'Интеграция в проект' })}
/>
<Layout flexBasis={[24, 160]} />
<Layout flexBasis={[56, 160]} />
</Column>
</Row>
)
Expand Down
20 changes: 20 additions & 0 deletions landing/fragments/landing-ticker/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@landing/ticker-fragment",
"version": "0.0.1",
"main": "src/index.ts",
"dependencies": {
"@ui/divider": "workspace:0.0.1",
"@ui/layout": "workspace:0.0.1",
"@ui/text": "workspace:0.0.1",
"@ui/utils": "workspace:0.0.1"
},
"devDependencies": {
"@emotion/react": "11.11.0",
"@emotion/styled": "11.11.0",
"react": "18.2.0"
},
"peerDependencies": {
"react": "*",
"react-dom": "*"
}
}
1 change: 1 addition & 0 deletions landing/fragments/landing-ticker/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './ticker.component'
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react'

import { Divider } from '@ui/divider'
import { Layout } from '@ui/layout'
import { Box } from '@ui/layout'

export const Delimiter = () => (
<Box width={[50, 96]} alignItems='center'>
<Layout flexBasis={[12, 24]} flexShrink='0' />
<Divider weight={[2, 5]} backgroundColor='white' />
<Layout flexBasis={[12, 24]} flexShrink='0' />
</Box>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './delimiter.component'
1 change: 1 addition & 0 deletions landing/fragments/landing-ticker/src/line/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './line.component'
52 changes: 52 additions & 0 deletions landing/fragments/landing-ticker/src/line/line.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import styled from '@emotion/styled'
import { keyframes } from '@emotion/react'

import React from 'react'
import { FC } from 'react'
import { useMemo } from 'react'

import { Box } from '@ui/layout'
import { Text } from '@ui/text'
import { Repeater } from '@ui/utils'

import { Delimiter } from './delimiter'
import { LineProps } from './line.interface'

export const Line: FC<LineProps> = ({ tech, font }) => {
const infinityLine = useMemo(
() => keyframes`0% { transform: translateX(0) } 100% { transform: translate(-50%) }`,
[]
)
const AnimBox = useMemo(
TorinAsakura marked this conversation as resolved.
Show resolved Hide resolved
() => styled(Box)({ animation: `${infinityLine} 400s linear infinite` }),
[infinityLine]
)

const techEl = useMemo(
TorinAsakura marked this conversation as resolved.
Show resolved Hide resolved
() =>
tech.map((el) => (
<>
<Delimiter />
<Text
color='white'
textTransform='uppercase'
fontSize={['greater', 'big']}
fontFamily={font}
lineHeight='small'
whiteSpace='nowrap'
>
{el}
</Text>
</>
)),
[tech, font]
)

return (
<Box>
<AnimBox>
<Repeater quantity={50}>{() => techEl}</Repeater>
</AnimBox>
</Box>
)
}
4 changes: 4 additions & 0 deletions landing/fragments/landing-ticker/src/line/line.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface LineProps {
tech: string[]
font?: string
}
1 change: 1 addition & 0 deletions landing/fragments/landing-ticker/src/technology/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './technology.component'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const TechnologyKit = {
webDevelopment: 'JavaScript,HTML,CSS,SASS,Vanilla JS,Jade',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ты издеваешься? это должен быть массив объектов, по которому можно итерироваться, завтра нам надо будет выбросить хтмл, чо, пойдёшь в код, править строку? А если опечатаешься?

Copy link
Contributor Author

@oxiqod oxiqod May 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TorinAsakura
Таким образом? ссылка
не смогла найти среди проектов как выполняется запись элементов именно для бегущей строки

так не верно? ты сказал именно объекты в массиве
export const technologyKit = {
webDev: ['JavaScript','HTML','CSS','SASS','Vanilla JS','Jade'],
workspace: ['Github','Atom','Figma']
}

или

export const KitWebDev = ['JavaScript','HTML','CSS','SASS','Vanilla JS','Jade']
export const KitWorkspace = ['Github','Atom','Figma']

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Что значит "не смогла найти как выполняется запись "ИМЕННО ДЛЯ БЕГУЩЕЙ СТРОКИ""?????

workspace: 'Github,Atom,Figma',
}
27 changes: 27 additions & 0 deletions landing/fragments/landing-ticker/src/ticker.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react'

import { Divider } from '@ui/divider'
import { Layout } from '@ui/layout'
import { Column } from '@ui/layout'
import { Row } from '@ui/layout'

import { Line } from './line'
import { TechnologyKit } from './technology'

export const Ticker = () => (
<Column>
<Layout flexBasis={[0, 64]} />
<Divider weight={1} backgroundColor='divider.transparent' />
<Layout flexBasis={[36, 64]} />
<Row overflow='hidden'>
<Line tech={TechnologyKit.webDevelopment.split(',')} font='primary' />
</Row>
<Layout flexBasis={[36, 64]} />
<Row overflow='hidden'>
<Line tech={TechnologyKit.workspace.split(',')} font='gellaDisplay' />
</Row>
<Layout flexBasis={[36, 64]} />
<Divider weight={1} backgroundColor='divider.transparent' />
<Layout flexBasis={[36, 64]} />
</Column>
)
1 change: 1 addition & 0 deletions landing/pages/index-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@landing/info-fragment": "workspace:0.0.1",
"@landing/navigation-fragment": "workspace:0.0.1",
"@landing/process-fragment": "workspace:0.0.1",
"@landing/ticker-fragment": "workspace:0.0.1",
"@ui/background": "workspace:0.0.1"
},
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions landing/pages/index-page/src/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Hero } from '@landing/hero-fragment'
import { Info } from '@landing/info-fragment'
import { Navigation } from '@landing/navigation-fragment'
import { Process } from '@landing/process-fragment'
import { Ticker } from '@landing/ticker-fragment'
import { Background } from '@ui/background'

export const IndexPage = () => (
Expand Down Expand Up @@ -43,6 +44,7 @@ export const IndexPage = () => (
backgroundPosition={['0,0 215px,0 0', '750px 310px,0 200px,0 0']}
>
<Process />
<Ticker />
</Background>
</>
)
Expand Down
3 changes: 2 additions & 1 deletion ui/button/src/button.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const ButtonElement = styled('button')<any>(
fillStyles
)

export const Button: FC<ButtonProps> = forwardRef(({ children, gap, ...props }) => {
export const Button: FC<ButtonProps> = forwardRef(({ children, gap, ...props }, ref) => {
const [hover, hoverProps] = useHover()
const [pressed, setPressed] = useState<boolean>(false)

Expand All @@ -37,6 +37,7 @@ export const Button: FC<ButtonProps> = forwardRef(({ children, gap, ...props })
onMouseUp={() => setPressed(false)}
{...hoverProps}
{...props}
ref={ref}
>
<Content divider={8}>{children}</Content>
<Layout flexBasis={gap} />
Expand Down
1 change: 1 addition & 0 deletions ui/button/src/button.interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ export interface ButtonProps extends BaseButtonProps {
iconWidth?: number
iconHeight?: number
iconRadius?: string
ref?: any
}
19 changes: 19 additions & 0 deletions ui/condition/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@ui/condition",
"version": "0.0.1",
"license": "BSD-3-Clause",
"main": "src/index.ts",
"dependencies": {
"framer-motion": "10.12.12"
},
"devDependencies": {
"@emotion/react": "11.11.0",
"@emotion/styled": "11.11.0",
"react": "18.2.0"
},
"peerDependencies": {
"@emotion/react": "*",
"@emotion/styled": "*",
"react": "*"
}
}
69 changes: 69 additions & 0 deletions ui/condition/src/condition.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import React from 'react'
import { AnimatePresence } from 'framer-motion'
import { motion } from 'framer-motion'

import { ConditionProps } from './condition.interface'

export const Condition = ({
match,
smooth = false,
smoothOptions = {
duration: 0.3,
pattern: 'in-and-out',
},
TorinAsakura marked this conversation as resolved.
Show resolved Hide resolved
children,
}: ConditionProps) => {
if (smooth) {
if (smoothOptions.pattern === 'in-and-out') {
return (
<AnimatePresence>
{match && (
<motion.div
style={{ display: 'flex', width: '100%', height: '100%' }}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: smoothOptions.duration }}
>
{children}
</motion.div>
)}
</AnimatePresence>
)
}
if (smoothOptions.pattern === 'in') {
return (
match && (
<motion.div
style={{ display: 'flex', width: '100%', height: '100%' }}
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: smoothOptions.duration }}
>
{children}
</motion.div>
)
)
}
if (smoothOptions.pattern === 'out') {
return (
<AnimatePresence>
{match && (
<motion.div
style={{ display: 'flex', width: '100%', height: '100%' }}
initial={{ opacity: 1 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: smoothOptions.duration }}
>
{children}
</motion.div>
)}
</AnimatePresence>
)
}
}
if (match) return children
return null
TorinAsakura marked this conversation as resolved.
Show resolved Hide resolved
}
11 changes: 11 additions & 0 deletions ui/condition/src/condition.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export interface SmoothOptions {
duration?: number
pattern?: 'in' | 'out' | 'in-and-out'
}

export interface ConditionProps {
match: boolean
smooth?: boolean
smoothOptions?: SmoothOptions
children?: any
}
1 change: 1 addition & 0 deletions ui/condition/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './condition.component'
4 changes: 4 additions & 0 deletions ui/theme/src/global.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export const GlobalStyles = () => {
return (
<Global
styles={css`
@font-face {
font-family: "GellaDisplay";
src: url("/font/gella-display.otf")
}
html,
body,
#__next {
Expand Down
1 change: 1 addition & 0 deletions ui/theme/src/theme/fontSizes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const fontSizes = {
normal: 32,
large: 40,
great: 44,
greater: 46,
solid: 56,
massive: 64,
big: 80,
Expand Down
1 change: 1 addition & 0 deletions ui/theme/src/theme/fonts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fonts = {
primary: 'Helvetica',
gella: 'GellaDisplay',
}

export { fonts }
4 changes: 2 additions & 2 deletions ui/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@ui/utils",
"version": "0.0.1",
"license": "MIT",
"license": "BSD-3-Clause",
"main": "src/index.ts",
"dependencies": {
"@ui/condition": "workspace: 0.0.1",
"react-laag": "2.0.5"
},
"devDependencies": {
"@types/react-dom": "18.2.4",
"react": "18.2.0",
"react-dom": "18.2.0"
},
Expand Down
1 change: 1 addition & 0 deletions ui/utils/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './hooks'
export * from './helpers'
export * from './repeater'
1 change: 1 addition & 0 deletions ui/utils/src/repeater/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './repeater.component'
21 changes: 21 additions & 0 deletions ui/utils/src/repeater/repeater.component.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react'
import { FC } from 'react'

import { Condition } from '@ui/condition'

import { RepeaterProps } from './repeater.interface'

const Repeater: FC<RepeaterProps> = ({ quantity, item, children }) => {
if (typeof children !== 'function') throw new Error('Repeater: children must be a function')

return (
<>
<Condition match={quantity === undefined}>{item?.map(children)}</Condition>
<Condition match={quantity !== undefined}>
{[...new Array(quantity)]?.map(children)}
</Condition>
</>
)
}

export { Repeater }
5 changes: 5 additions & 0 deletions ui/utils/src/repeater/repeater.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface RepeaterProps {
quantity?: number
item?: Array<string>
children: () => any
}
Loading