-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Homepage cms #2029
Merged
Merged
Homepage cms #2029
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
254d21f
feat(hero): connect hero to cms
jomarmontuya f4fe843
feat(tabsection): connect tab section component back to cms
jomarmontuya 6c025c5
feat(entreprisegrowth): connect enterprise component to cms
jomarmontuya 9b45489
feat(feature testimonials): connect feature testimonials to cms
jomarmontuya eac39f0
feat(single testimonials): connect single testimonials
jomarmontuya 09f8584
feat(enterprise): fix image case study
jomarmontuya c2a026d
feat(homepage): complete connected everything to cms
jomarmontuya 233d039
feat(cleanup): cleanup
jomarmontuya dbca7fc
Merge branch 'stage' into homepage-cms
jomarmontuya 7ba0db8
feat(resolve conflicts): fix conflcits
jomarmontuya 5e40e9c
feat(run format): run format
jomarmontuya 2cf33ee
Merge branch 'stage' into homepage-cms
giseleblair File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,11 @@ const GetDemoSection = dynamic(() => import('revamp/ui/GetDemoSection'), { | |
loading: () => <p>Loading...</p>, | ||
}); | ||
|
||
export const removeHTMLtags = (str) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move this in utils file we can use it later |
||
if (str == '' || str == null || str == undefined) return undefined; | ||
return str.replace(/<[^>]*>/g, ''); | ||
}; | ||
|
||
function Homepage({ content }) { | ||
const { palette } = useTheme(); | ||
const isLoggedIn = useIsLoggedIn(); | ||
|
@@ -90,17 +95,110 @@ function Homepage({ content }) { | |
} | ||
}, [content.zesty.isAuthenticated, isLoggedIn]); | ||
|
||
const heroProps = { | ||
HeroText: removeHTMLtags(content?.header_title_and_description) | ||
.replace('&', '&') | ||
.split(','), | ||
primaryBtn: content?.primarybtn, | ||
primaryBtnLink: content?.primarybtnlink?.data?.[0].meta?.web?.uri, | ||
secondaryBtn: content?.secondarybtn, | ||
secondaryBtnLink: content?.secondarybtnlink?.data?.[0].meta?.web?.uri, | ||
subtitle2: content?.subtitle, | ||
heroImage: content?.header_graphic?.data?.[0]?.url, | ||
}; | ||
|
||
const tabSectionProps = { | ||
header: removeHTMLtags(content?.features_title), | ||
tabs: content?.features_options, | ||
}; | ||
|
||
const statsProps = { | ||
title: content?.stats_title, | ||
header: content?.stats_header, | ||
subHeading: content?.stats_subheading, | ||
}; | ||
|
||
const enterpriseProps = { | ||
overline: content?.enterprise_overline, | ||
heading: content?.enterprise_heading, | ||
supportingText: content?.enterprise_supporting_text, | ||
primaryBtn: content?.enterprise_primary_btn_text, | ||
primaryBtnLink: content?.enterprise_primary_btn_link, | ||
secondaryBtn: content?.enterprise_secondary_btn_text, | ||
secondaryBtnLink: content?.enterprise_secondary_btn_link, | ||
caseStudiesList: content?.enterpise_case_study?.data?.map((item) => { | ||
return { | ||
mainImage: item?.main_image?.data?.[0]?.url, | ||
logo: item?.logo?.data?.[0]?.url, | ||
description: item?.description, | ||
link: item?.link?.data[0]?.meta?.web?.uri, | ||
}; | ||
}), | ||
}; | ||
|
||
const regex = /<li>(.*?)<\/li>/g; | ||
const featureTestimonialsList = []; | ||
|
||
// Use a loop to iterate through matches and extract the text content | ||
let match; | ||
while ( | ||
(match = regex.exec(content?.feature_testimonial_list_items)) !== null | ||
) { | ||
featureTestimonialsList.push(match[1]); | ||
} | ||
|
||
const featureTestimonialsProps = { | ||
overline: content?.feature_testimonial_overline, | ||
heading: content?.feature_testimonial_heading, | ||
supportingText: content?.feature_testimonial_supporting__text, | ||
image: content.feature_testimonial_image?.data?.[0]?.url, | ||
testimonial: content?.feature_testimonial_, | ||
testimonialLogo: content.feature_testimonial_logo?.data?.[0]?.url, | ||
lists: featureTestimonialsList, | ||
}; | ||
|
||
const singleTestimonialProps = { | ||
witness: content?.singletestimonial_witness?.data?.[0]?.url, | ||
name: content?.singletestimonial_name, | ||
role: content?.singletestimonial_role, | ||
logo: content?.singletestimonial_logo?.data?.[0]?.url, | ||
header: content?.singletestimonial_header, | ||
quote: content?.singletestimonial_quote, | ||
}; | ||
|
||
const gridFeatureProps = { | ||
overline: content?.grid_feature_overline, | ||
heading: content?.grid_feature_heading, | ||
supportingText: content?.grid_feature_supporting_text, | ||
featureLists: content?.grid_feature_list?.data?.map((item) => { | ||
return { | ||
image: item?.feature_image?.data?.[0]?.url, | ||
title: item?.feature_title, | ||
description: item?.feature_description, | ||
}; | ||
}), | ||
}; | ||
|
||
const securityFeatureProps = { | ||
overline: content?.security_feature_overline, | ||
heading: content?.security_feature_heding, | ||
supportingText: content?.security_feature_supporting_text, | ||
image: content?.security_feature_image?.data?.[0]?.url, | ||
}; | ||
|
||
return ( | ||
<> | ||
<ThemeProvider theme={() => revampTheme(palette.mode)}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2 themeproviders ? |
||
<Hero /> | ||
<TabsSection /> | ||
<Stats /> | ||
<EnterpriseGrowth /> | ||
<FeatureBulletWithTestimonials /> | ||
<SingleTestimonial /> | ||
<GridFeature /> | ||
<SecurityFeature /> | ||
<Hero {...heroProps} /> | ||
</ThemeProvider> | ||
<ThemeProvider theme={() => revampTheme(palette.mode)}> | ||
<TabsSection {...tabSectionProps} /> | ||
<Stats {...statsProps} /> | ||
<EnterpriseGrowth {...enterpriseProps} /> | ||
<FeatureBulletWithTestimonials {...featureTestimonialsProps} /> | ||
<SingleTestimonial {...singleTestimonialProps} /> | ||
<GridFeature {...gridFeatureProps} /> | ||
<SecurityFeature {...securityFeatureProps} /> | ||
<GetDemoSection /> | ||
</ThemeProvider> | ||
</> | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
widht and ht?