Skip to content

Commit

Permalink
refactor: replace Row and Col - wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kristofferlarberg committed Dec 8, 2022
1 parent 8eaf20a commit 2e6cc3d
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 28 deletions.
25 changes: 10 additions & 15 deletions client/src/components/Carousel/Carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useEffect, useState } from 'react'
import Image from 'next/image'
import { useNextSanityImage } from 'next-sanity-image'
import styled from 'styled-components'
import { Row, Col } from 'react-bootstrap'
import Gravatar from 'react-gravatar'
import Slider from 'react-slick'
import { rgba } from 'polished'
Expand Down Expand Up @@ -308,20 +307,16 @@ export const Carousel = ({ content, coworker = false }) => {
}
return (
<Container>
<Row className="justify-content-center">
<Col lg="12" xl="11">
<SliderStyled {...slickSettings} activeSlide={activeSlide}>
{content.map((person, i) => {
const active = activeSlide === i
return coworker ? (
<Coworker item={person} key={i} active={active} />
) : (
<Client item={person} key={i} active={active} />
)
})}
</SliderStyled>
</Col>
</Row>
<SliderStyled {...slickSettings} activeSlide={activeSlide}>
{content.map((person, i) => {
const active = activeSlide === i
return coworker ? (
<Coworker item={person} key={i} active={active} />
) : (
<Client item={person} key={i} active={active} />
)
})}
</SliderStyled>
</Container>
)
}
20 changes: 20 additions & 0 deletions client/src/components/Layout/Flex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import clsx from 'clsx'
import React from 'react'

export const Flex = ({ col, children, className }) => {
return (
<div
className={clsx(
className,
col === 2
? 'lg:tw-gap-20 [&>*]:tw-w-full lg:[&>*]:tw-w-1/2'
: col === 3
? '[&>*]:tw-w-full lg:[&>*]:tw-w-1/3'
: '[&>*]:tw-w-full',
'tw-flex tw-flex-col tw-gap-8 lg:tw-flex-row [&>*]:tw-w-full'
)}
>
{children}
</div>
)
}
1 change: 1 addition & 0 deletions client/src/components/Layout/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { Container } from './Container'
export { Layout } from './Layout'
export { Flex } from './Flex'
15 changes: 7 additions & 8 deletions client/src/pages/book.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect } from 'react'
import { NextSeo } from 'next-seo'
import { Row, Col } from 'react-bootstrap'
import { groq } from 'next-sanity'

import {
Expand All @@ -16,7 +15,7 @@ import { Hero } from '../features/Hero'
import { usePreviewSubscription } from '../lib/sanity'
import { getClient } from '../lib/sanity.server'
import { HubspotForm } from '../features/HubspotForm'
import { Container } from '../components/Layout'
import { Container, Flex } from '../components/Layout'

const Book = ({ data, preview = false }) => {
const { data: previewData } = usePreviewSubscription(data?.bookPageQuery, {
Expand Down Expand Up @@ -76,14 +75,14 @@ const Book = ({ data, preview = false }) => {
)}
<Section>
<Container>
<Row>
<Col lg={6}>
<Flex col={2}>
<div>
<HubspotForm
value="contact1"
title="Boka ett möte i kalendern"
/>
</Col>
<Col lg={5} className="offset-lg-1 order-lg-2 mt-lg-0">
</div>
<div>
<Box className="tw-mb-6">
<Typography.H2>
{page?.call?.title && page.call.title}
Expand Down Expand Up @@ -135,8 +134,8 @@ const Book = ({ data, preview = false }) => {
/>
</Box>
))}
</Col>
</Row>
</div>
</Flex>
</Container>
</Section>
</PageWrapper>
Expand Down
10 changes: 5 additions & 5 deletions client/src/pages/open-source-skolan/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { getClient } from '../../lib/sanity.server'
import { filterDataToSingleItem } from '../../utils/helpers'
import { BlogList } from '../../features/Aktuellt'
import { ExitPreviewLink } from '../../components/ExitPreviewLink'
import { Container } from '../../components/Layout'
import { Container, Flex } from '../../components/Layout'

const VideoContainer = styled.div`
position: relative;
Expand Down Expand Up @@ -127,13 +127,13 @@ const LessonDetails = ({ data, preview = false }) => {
<Section className="pb-0">
<div className="pt-5"></div>
<Container>
<Row className="justify-content-center text-center">
<Col lg="12">
<Flex className="justify-content-center text-center">
<div>
<Typography.H2>
Se fler lektioner i Open Source skolan
</Typography.H2>
</Col>
</Row>
</div>
</Flex>
</Container>
</Section>
<BlogList posts={data.lessons} />
Expand Down

0 comments on commit 2e6cc3d

Please sign in to comment.