Skip to content

Commit

Permalink
Merge pull request #8 from Brahmware:add-koel-container
Browse files Browse the repository at this point in the history
Update: ltr rtl responsiveness fixed
  • Loading branch information
sanchayan721 authored Sep 13, 2023
2 parents 50a38af + bd612a4 commit db7476b
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 16 deletions.
Binary file added public/images/home/container-4/image-bottom.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/home/container-4/image-top.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 9 additions & 3 deletions src/containers/Koel/Content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { Box, BoxProps, Divider, Typography, styled } from '@mui/material';
import Link from 'next/link';
import React from 'react';

interface KoelShowcaseProps extends BoxProps {
export interface KoelShowcaseProps extends BoxProps {
direction?: 'ltr' | 'rtl';
title?: string;
sloganHTML?: string;
descriptionHTML?: string;
Expand All @@ -16,6 +17,7 @@ interface KoelShowcaseProps extends BoxProps {
};

const Content: React.FC<KoelShowcaseProps> = ({
direction,
title,
sloganHTML,
descriptionHTML,
Expand Down Expand Up @@ -72,19 +74,23 @@ const Content: React.FC<KoelShowcaseProps> = ({
)
};

export default styled(Content)(({ theme }) => ({
export default styled(Content)(({ theme, direction = 'ltr' }) => ({
height: 'max-content',
width: '50%',
margin: 'auto 0',

[theme.Breakpoints.down('lg')]: {
width: '100%',
gridColumn: '10 / 20',
gridColumn: (direction === 'ltr') ? '10 / 20' : '-10 / -20',
gridRow: '9 / 20',
},

[theme.Breakpoints.down('md')]: {
gridColumn: '2 / 20',
gridRow: '10 / 19',
},

[theme.Breakpoints.down('xs')]: {
gridRow: '9 / 21',
},
}));
9 changes: 5 additions & 4 deletions src/containers/Koel/Showcase/Potrait/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ const PotraitImage = styled(Image)(({ theme }) => ({
}));

interface PotraitProps extends BoxProps {
direction?: 'ltr' | 'rtl';
image: ShowcaseImage
}

const Potrait: React.FC<PotraitProps> = ({ image, ...props }) => {
const Potrait: React.FC<PotraitProps> = ({ direction, image, ...props }) => {
return (
<Box {...props}>
<PotraitImage
Expand All @@ -27,7 +28,7 @@ const Potrait: React.FC<PotraitProps> = ({ image, ...props }) => {
)
};

export default styled(Potrait)(({ theme }) => ({
export default styled(Potrait)(({ theme, direction = 'ltr' }) => ({
width: '100%',
height: '100%',
gridColumn: '6 / 17',
Expand All @@ -40,13 +41,13 @@ export default styled(Potrait)(({ theme }) => ({
overflow: 'hidden',

[theme.Breakpoints.down('lg')]: {
gridColumn: '2 / 9',
gridColumn: (direction === 'ltr') ? '2 / 9' : '-2 / -9',
gridRow: '7 / 21',
},

[theme.Breakpoints.down('md')]: {
gridColumn: '13 / 20',
gridRow: '4 / 13',
gridRow: '3 / 12',
aspectRatio: '1 / 1',
},

Expand Down
6 changes: 4 additions & 2 deletions src/containers/Koel/Showcase/Ribbon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ const Filter = styled('div')(({ theme }) => ({
}));

interface RibbonProps extends BoxProps {
direction?: 'ltr' | 'rtl';
image: ShowcaseImage
}

const Ribbon: React.FC<RibbonProps> = ({
direction = 'ltr',
image,
...props
}) => {
Expand All @@ -43,10 +45,10 @@ const Ribbon: React.FC<RibbonProps> = ({
)
};

export default styled(Ribbon)(({ theme }) => ({
export default styled(Ribbon)(({ theme, direction }) => ({
height: '100%',
width: '100%',
gridColumn: '1 / 10',
gridColumn: (direction === 'ltr') ? '1 / 10' : '11 / 21',
gridRow: '1 / 21',
position: 'relative',

Expand Down
8 changes: 5 additions & 3 deletions src/containers/Koel/Showcase/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@ export type ShowcaseImage = {
alt?: string;
description?: string;
}
interface KoelShowcaseProps extends BoxProps {
export interface KoelShowcaseProps extends BoxProps {
direction?: 'ltr' | 'rtl';
top: ShowcaseImage,
bottom: ShowcaseImage
};

const Showcase: React.FC<KoelShowcaseProps> = ({
direction = 'ltr',
top,
bottom,
...props
}) => {
return (
<Box {...props}>
<Ribbon image={bottom} />
<Potrait image={top} />
<Ribbon image={bottom} direction={direction} />
<Potrait image={top} direction={direction} />
</Box>
)
};
Expand Down
7 changes: 3 additions & 4 deletions src/containers/Koel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ interface KoelProps {

const Koel: React.FC<KoelProps> = ({
images,
direction,
direction = 'ltr',
content,
...props
}) => {
return (
<section {...props} >
<Showcase {...images} />
<Content {...content} />
<Showcase {...images} direction={direction} />
<Content {...content} direction={direction} />
</section>
)
};
Expand All @@ -49,7 +49,6 @@ export default styled(Koel)(({ theme, direction = 'ltr' }) => ({

[theme.Breakpoints.down('lg')]: {
display: 'grid',
marginTop: theme.Spaces.sm,
padding: 0,
gridTemplateColumns: 'repeat(20, 1fr)',
gridTemplateRows: 'repeat(20, 1fr)',
Expand Down
22 changes: 22 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@ const Home: NextPage = () => {
}
}}
/>
<Koel
direction="rtl"
images={{
top: {
src: '/images/home/container-4/image-top.jpg',
},
bottom: {
src: '/images/home/container-4/image-bottom.jpg',
},
}}
content={{
title: 'IMMERSIVE TEACHING',
sloganHTML: `A Strategy to <br />
Revolutionize Learning`,
descriptionHTML: `Grasping attention is easier, keeping learners engaged throughout the process and command action is a different story. We learn much faster visually, and retention is simply great if it is rewarding. In comes the array of Immersive education for new generation of India. <br />
Putting our best foot forward, IMS resources are used in teaching the new wave of decision-makers. Integrating with schools and teaching organizations, creating the seamless streaming of knowledge like never before.`,
button: {
buttonText: 'VIEW MORE',
link: '/education-and-teaching/resources'
}
}}
/>
</MainLayout>
</React.Fragment>
);
Expand Down

0 comments on commit db7476b

Please sign in to comment.