Skip to content

Commit 64f25c9

Browse files
committed
change how two column handles diff contentType
1 parent 9e6e2ea commit 64f25c9

File tree

2 files changed

+36
-43
lines changed

2 files changed

+36
-43
lines changed

components/containers/TwoColumn/TwoColumn.js

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Image from 'next/image';
22
import ButtonLink from '@/components/buttons/ButtonLink/ButtonLink';
33
import Container from '@/components/containers/Container/Container';
4-
import * as TwoColumnStyles from './styles';
4+
import TwoColumnStyles from './styles';
55

66
export default function TwoColumn({
77
image,
@@ -20,31 +20,10 @@ export default function TwoColumn({
2020
$contentType,
2121
}) {
2222
//Set Styles base don content type
23-
let S;
24-
switch ($contentType) {
25-
case 'our-process':
26-
S = TwoColumnStyles.OurProcess;
27-
case 'get-started':
28-
S = TwoColumnStyles.GetStarted;
29-
case 'our-purpose':
30-
S = TwoColumnStyles.OurPurpose;
31-
case 'our-background':
32-
S = TwoColumnStyles.OurBackground;
33-
case 'get-involved':
34-
S = TwoColumnStyles.GetInvolved;
35-
case 'non-profit':
36-
S = TwoColumnStyles.NonProfit;
37-
case 'wanna-learn-more':
38-
S = TwoColumnStyles.WannaLearnMore;
39-
case 'questions':
40-
S = TwoColumnStyles.QuestionsMore;
41-
case 'two-text-columns':
42-
S = TwoColumnStyles.TwoTextColumns;
43-
case 'second-text-column':
44-
S = TwoColumnStyles.SecondTextColumn;
45-
default:
46-
S = TwoColumnStyles.Base;
47-
}
23+
const S = TwoColumnStyles.$contentType
24+
? TwoColumnStyles.$contentType
25+
: TwoColumnStyles.base;
26+
4827
// Add rowOrder="row-reverse" prop to the component to reverse its order on desktop
4928
return (
5029
<S.TwoColumnWrapper $color={color} $bgColor={bgColor}>

components/containers/TwoColumn/styles.js

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const InnerImage = styled(Image)`
8282
object-fit: cover;
8383
`;
8484

85-
export const Base = {
85+
const BaseStyles = {
8686
TwoColumnWrapper,
8787
InnerContainer,
8888
InnerContent,
@@ -98,7 +98,7 @@ const AboutUsInnerImage = styled(InnerImage)`
9898
`;
9999

100100
const AboutUs = {
101-
...Base,
101+
...BaseStyles,
102102
InnerImage: AboutUsInnerImage,
103103
};
104104

@@ -112,7 +112,7 @@ const OurProcessInnerImageWrapper = styled(InnerImageWrapper)`
112112
`)}
113113
`;
114114

115-
export const OurProcess = {
115+
const OurProcess = {
116116
...AboutUs,
117117
InnerImageWrapper: OurProcessInnerImageWrapper,
118118
};
@@ -138,7 +138,7 @@ const GetStartedInnerImageWrapper = styled(InnerImageWrapper)`
138138
`)}
139139
`;
140140

141-
export const GetStarted = {
141+
const GetStarted = {
142142
...AboutUs,
143143
InnerContainer: GetStartedInnerContainer,
144144
InnerImageWrapper: GetStartedInnerImageWrapper,
@@ -154,7 +154,7 @@ const OurPurposeInnerImageWrapper = styled(InnerImageWrapper)`
154154
`)}
155155
`;
156156

157-
export const OurPurpose = {
157+
const OurPurpose = {
158158
...AboutUs,
159159
InnerImageWrapper: OurPurposeInnerImageWrapper,
160160
};
@@ -169,7 +169,7 @@ const OurBackgroundInnerImageWrapper = styled(InnerImageWrapper)`
169169
`)}
170170
`;
171171

172-
export const OurBackground = {
172+
const OurBackground = {
173173
...AboutUs,
174174
InnerImageWrapper: OurBackgroundInnerImageWrapper,
175175
};
@@ -182,8 +182,8 @@ const GetInvolvedInnerContainer = styled(InnerContainer)`
182182
`)}
183183
`;
184184

185-
export const GetInvolved = {
186-
...Base,
185+
const GetInvolved = {
186+
...BaseStyles,
187187
InnerContainer: GetInvolvedInnerContainer,
188188
};
189189

@@ -195,8 +195,8 @@ const NonProfitInnerContent = styled(InnerContent)`
195195
`)}
196196
`;
197197

198-
export const NonProfit = {
199-
...Base,
198+
const NonProfit = {
199+
...BaseStyles,
200200
InnerContent: NonProfitInnerContent,
201201
};
202202

@@ -218,8 +218,8 @@ const WannaLearnMoreInnerImage = styled(InnerImage)`
218218
object-fit: contain;
219219
`;
220220

221-
export const WannaLearnMore = {
222-
...Base,
221+
const WannaLearnMore = {
222+
...BaseStyles,
223223
Content: WannaLearnMoreContent,
224224
InnerImageWrapper: WannaLearnMoreInnerImageWrapper,
225225
InnerImage: WannaLearnMoreInnerImage,
@@ -246,7 +246,7 @@ const QuestionsInnerImageWrapper = styled(InnerImageWrapper)`
246246
`)}
247247
`;
248248

249-
export const QuestionsMore = {
249+
const QuestionsMore = {
250250
...AboutUs,
251251
InnerContainer: QuestionsInnerContainer,
252252
InnerImageWrapper: QuestionsInnerImageWrapper,
@@ -283,8 +283,8 @@ const TwoTextColumnsInnerContent = styled(InnerContent)`
283283
`)}
284284
`;
285285

286-
export const TwoTextColumns = {
287-
...Base,
286+
const TwoTextColumns = {
287+
...BaseStyles,
288288
InnerContainer: TwoTextColumnsInnerContainer,
289289
InnerContent: TwoTextColumnsInnerContent,
290290
};
@@ -301,8 +301,22 @@ const SecondTextColumnInnerContainer = styled(InnerContainer)`
301301
margin: 0px;
302302
`;
303303

304-
export const SecondTextColumn = {
305-
...Base,
304+
const SecondTextColumn = {
305+
...BaseStyles,
306306
InnerContainer: SecondTextColumnInnerContainer,
307307
InnerContent: SecondTextColumnInnerContent,
308308
};
309+
310+
export default {
311+
'our-process': OurProcess,
312+
'get-started': GetStarted,
313+
'our-purpose': OurPurpose,
314+
'our-background': OurBackground,
315+
'get-involved': GetInvolved,
316+
'non-profit': NonProfit,
317+
'wanna-learn-more': WannaLearnMore,
318+
questions: QuestionsMore,
319+
'two-text-columns': TwoTextColumns,
320+
'second-text-column': SecondTextColumn,
321+
base: BaseStyles,
322+
};

0 commit comments

Comments
 (0)