Skip to content

Commit

Permalink
Merge pull request #4334 from 8rxn/edit-page-2
Browse files Browse the repository at this point in the history
Add Edit This Page link in footer.
  • Loading branch information
leecalcote authored Jun 30, 2023
2 parents 07f103a + 5563fc6 commit aaec2a8
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/components/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Layout = ({ children }) => {
<Navigation/>
{children}
<ScrollToTopBtn />
<Footer />
<Footer location={children.props.location} />
</>
);
};
Expand Down
10 changes: 5 additions & 5 deletions src/sections/General/Footer/footer.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const FooterWrapper = styled.section`
transition: 0.2s all;
color: rgba(255, 255, 255, 0.8);
&:hover {
color: ${props => props.theme.secondaryColor};
color: ${(props) => props.theme.secondaryColor};
}
}
}
Expand All @@ -61,7 +61,7 @@ const FooterWrapper = styled.section`
transition: 0.2s all;
&:hover{
color: ${props => props.theme.secondaryColor};
color: ${(props) => props.theme.secondaryColor};
}
}
Expand All @@ -74,7 +74,7 @@ const FooterWrapper = styled.section`
border-radius: .25rem;
vertical-align: top;
text-transform: uppercase;
color: ${props => props.theme.saffronLightColor};
color: ${(props) => props.theme.saffronLightColor};
}
}
}
Expand Down Expand Up @@ -134,7 +134,7 @@ const FooterWrapper = styled.section`
color: #CCCCCC;
}
a:hover {
color: ${props => props.theme.secondaryColor};
color: ${(props) => props.theme.secondaryColor};
}
}
li + li {
Expand Down Expand Up @@ -280,4 +280,4 @@ const FooterWrapper = styled.section`
}
`;

export default FooterWrapper;
export default FooterWrapper;
98 changes: 77 additions & 21 deletions src/sections/General/Footer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,39 @@ import Button from "../../../reusecore/Button";
import FooterWrapper from "./footer.style";
import bubblesElement from "./images/bubbles-element.svg";

const Footer = () => {
const Footer = ({ location }) => {
var currentYear = new Date().getFullYear();




const getUrl = (pathname) => {
//remove ".html" that results in live production build
if (pathname.endsWith(".html")) {
pathname = pathname.replace(".html", "");
}

const indexUrl = ["/", "/blog", "/careers", "/meshery", "/meshmap", "/community", "/handbook", "projects", "/resources", "/learn"];
const test = {
mdx: function(path){
let returnPath = "";
return ["/blog/", "/careers/","/community/events", "/integrations/", "/landscape/", "/members/", "/news/", "/programs", "/projects/", "/resources/", "/service-mesh-books/", "/service-mesh-labs/", "/service-mesh-workshops/"].some((check) => {
returnPath = check; return path.startsWith(check);
}) && `src/collections${returnPath}`;
},
learningPath: function(path) {
return path.startsWith("/learn/learning-paths/") && `content-learn${pathname.replace("learn/learning-paths/", "")}`;
},

};

return test.mdx(pathname) ? `https://github.com/layer5io/layer5/tree/master/${test.mdx(pathname)}` : (test.learningPath(pathname) ? `https://github.com/layer5io/layer5/tree/master/${test.learningPath(pathname)}` : `https://github.com/layer5io/layer5/blob/master/src/pages${pathname == "/" ? "" : pathname}${indexUrl.some(str => pathname.endsWith(str)) ? "/index" : ""}.js`);

};




return (
<FooterWrapper>
<img
Expand All @@ -30,7 +61,9 @@ const Footer = () => {
<Row>
<Col xs={12} lg={3}>
<p className="desc-info">
An empowerer of engineers, Layer5 helps you extract more value from your infrastructure. Creator and maintainer of cloud naative standards. Maker of Meshery, the cloud native manager.
An empowerer of engineers, Layer5 helps you extract more value
from your infrastructure. Creator and maintainer of cloud native
standards. Maker of Meshery, the cloud native manager.
</p>
</Col>
<Col className="sections_col" xs={12} lg={9}>
Expand All @@ -43,10 +76,8 @@ const Footer = () => {
</h3>
<ul className="section-categories">
<li>
<Link
className="category-link"
to="/learn/learning-paths"
>Learning Paths
<Link className="category-link" to="/learn/learning-paths">
Learning Paths
</Link>
</li>
<li>
Expand Down Expand Up @@ -124,7 +155,10 @@ const Footer = () => {
</Link>
</li>
<li>
<Link className="category-link" to="/community/handbook/writing-program">
<Link
className="category-link"
to="/community/handbook/writing-program"
>
Writing Program
</Link>
</li>
Expand Down Expand Up @@ -183,7 +217,6 @@ const Footer = () => {
Service Mesh Performance
</Link>
</li>

</ul>
</div>
<div className="footer-sections even-col">
Expand Down Expand Up @@ -227,6 +260,25 @@ const Footer = () => {
</div>
</Row>
<Row className="subscribe">
{/* <Col sm={4} className="edit-page">
<span> Get Involved </span>
<a href={getUrl(location.pathname)} target="_blank" rel="noreferrer">
<span>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="inherit"
height="24"
viewBox="0 -960 960 960"
width="24"
>
<path d="M490.001-130.001v-71.153l208.923-208.922 71.152 71.152-208.922 208.923h-71.153Zm-360-200v-59.998h280v59.998h-280Zm668.075-36.923-71.152-71.152 29-29q8.692-8.693 21.076-8.693t21.076 8.693l29 29q8.693 8.692 8.693 21.076t-8.693 21.076l-29 29ZM130.001-490.001v-59.998h440v59.998h-440Zm0-160v-59.998h440v59.998h-440Z" />
</svg>
<p>Edit This Page</p>
</span>
</a>
</Col> */}
<form
name="contactform"
method="post"
Expand All @@ -240,8 +292,10 @@ const Footer = () => {
placeholder="Email Address"
name="EMAIL"
id="mce-EMAIL-2"
onInvalid={e => e.target.setCustomValidity("Please fill-in this field")}
onInput={e => e.target.setCustomValidity("")}
onInvalid={(e) =>
e.target.setCustomValidity("Please fill-in this field")
}
onInput={(e) => e.target.setCustomValidity("")}
required
/>
<Button
Expand All @@ -261,6 +315,14 @@ const Footer = () => {
{currentYear} Copyright ©Layer5, Inc | All Rights Reserved
</p>
<ul className="policies">
<li className="edit-page">
{/* We are an
{" "}
<Link to="/company/about">open source-first organization</Link>. */}
<a href={getUrl(location.pathname)} target="_blank" rel="noreferrer">
Edit This Page
</a>
</li>
<li>
<a
href="https://layer5.statuspage.io"
Expand All @@ -270,19 +332,13 @@ const Footer = () => {
Status
</a>
</li>


<li>
<a
href="/company/legal/privacy"
>
Privacy
</a>
<a href="/company/legal/privacy">Privacy</a>
</li>
<li>
<a
href="/company/legal/terms-of-service"
>
Terms
</a>
<a href="/company/legal/terms-of-service">Terms</a>
</li>
</ul>
</div>
Expand All @@ -292,4 +348,4 @@ const Footer = () => {
);
};

export default Footer;
export default Footer;

0 comments on commit aaec2a8

Please sign in to comment.