Skip to content

Commit

Permalink
Merge pull request #6015 from NishantSinghhhhh/Link_Component
Browse files Browse the repository at this point in the history
Link component
  • Loading branch information
sudhanshutech authored Oct 28, 2024
2 parents dffb231 + b13dece commit d373678
Show file tree
Hide file tree
Showing 8 changed files with 635 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/pages/projects/sistent/components/link/code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from "react";
import { LinkCode } from "../../../../../sections/Projects/Sistent/components/link/code";

const LinkCodePage = () => {
return <LinkCode />;
};

export default LinkCodePage;
8 changes: 8 additions & 0 deletions src/pages/projects/sistent/components/link/guidance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from "react";
import { LinkGuidancePage } from "../../../../../sections/Projects/Sistent/components/link/guidance";

const LinkGuidance = () => {
return <LinkGuidancePage />;
};

export default LinkGuidance;
8 changes: 8 additions & 0 deletions src/pages/projects/sistent/components/link/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from "react";
import SistentLink from "../../../../../sections/Projects/Sistent/components/link/index";

const SistentButtonPage = () => {
return <SistentLink />;
};

export default SistentButtonPage;
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState } from "react";
import Code from "../../../../../components/CodeBlock";

export const CodeBlock = ({ name, code }) => {
const [showCode, setShowCode] = useState(false);
const onChange = () => {
Expand Down
10 changes: 9 additions & 1 deletion src/sections/Projects/Sistent/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,15 @@ const componentsData = [
description:
"The TextField component is a versatile input field used to capture user input in forms and user interfaces.",
url: "/projects/sistent/components/text-field",
}
},
{
id: 7,
name: "Link",
description:
"Links are essential and integral components of an interface. They are primarily used for navigation, guiding users to the next step in a journey or redirecting them to relevant sections or pages.",
url: "/projects/sistent/components/link",
},

];

const SistentComponents = () => {
Expand Down
261 changes: 261 additions & 0 deletions src/sections/Projects/Sistent/components/link/code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
import React from "react";
import { navigate } from "gatsby";
import { useLocation } from "@reach/router";

import { SistentThemeProvider, Link } from "@layer5/sistent";
import { CodeBlock } from "../button/code-block";
// import { FaArrowRight } from "@react-icons/all-files/fa/FaArrowRight";
import { SistentLayout } from "../../sistent-layout";

import TabButton from "../../../../../reusecore/Button";
import { useStyledDarkMode } from "../../../../../theme/app/useStyledDarkMode";

const codes = [
`<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<Link
href="Your Link"
style={{
textDecoration: "none",
padding: "6px",
marginLeft: "10px",
}}
>
Simple Link
</Link>
</SistentThemeProvider>`,

`<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<Link href="Your Path"
style={{
textDecoration: "none",
color: "blue",
padding: "6px",
marginLeft: "10px",
}}
>
Colored Link
</Link>
</SistentThemeProvider>`,

`<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<Link
href="Your Path"
style={{
textDecoration: "underline",
padding: "6px",
marginLeft: "10px",
}}
>
Underlined Link
</Link>
</SistentThemeProvider>
`,

` <SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<Link
href="Your Path"
style={{
textDecoration: "none",
color: "blue",
fontWeight: "bold",
fontSize: "16px",
padding: "6px",
marginLeft: "10px",
borderBottom: "2px dashed blue",
}}
>
Customized Link
</Link>
</SistentThemeProvider>`,

` <SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<Link
href="https://your-link.com"
target="_blank"
rel="noopener noreferrer"
style={{
textDecoration: "underline",
padding: "6px",
marginLeft: "10px",
}}
>
Visit Secure Link
</Link>
</SistentThemeProvider>`
];

export const LinkCode = () => {
const location = useLocation();
const { isDark } = useStyledDarkMode();

return (
<SistentLayout title="Link" >
<div className="content">
<a id="Identity">
<h2>Link</h2>
</a>
<p>
</p>
<div className="filterBtns">
<TabButton
className={
location.pathname === "/projects/sistent/components/link"
? "active"
: ""
}
onClick={() => navigate("/projects/sistent/components/link")}
title="Overview"
/>
<TabButton
className={
location.pathname ===
"/projects/sistent/components/link/guidance"
? "active"
: ""
}
onClick={() =>
navigate("/projects/sistent/components/link/guidance")
}
title="Guidance"
/>
<TabButton
className={
location.pathname === "/projects/sistent/components/link/code"
? "active"
: ""
}
onClick={() => navigate("/projects/sistent/identity/color/code")}
title="Code"
/>
</div>
<div className="main-content">
<p>
Links are fundamental components in web navigation, allowing users to move between different pages or resources. Their design and implementation are crucial for creating a seamless browsing experience.
</p>
<a id="Simple Link">
<h2>Simple Link</h2>
</a>
<p>The link can be presented in a simple format, primarily as underlined text that serves as a gateway to navigate users to other pages or resources, without any prominent styling or buttons attached to it.</p>
<div className="showcase">
<div className="items">
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<Link
href="your path"
style={{
textDecoration: "none",
padding: "6px",
marginLeft: "10px",
}}
>
Simple Link
</Link>
</SistentThemeProvider>
</div>
<CodeBlock name="simple-link" code={codes[0]} />
</div>
<a id="Customized Links">
<h2>Customized Links</h2>
</a>
<p>
Customized Links enhance user experience by adapting their design and behavior to match the app’s theme. They can include personalized styles, hover effects, or icons, ensuring both visual consistency and improved usability across the website.
</p>

<h3>Colored Link</h3>
<p>
Colored Links can help draw attention to key areas of a page. They are styled with custom colors to stand out and indicate their importance, enhancing navigation and usability.
</p>
<div className="showcase">
<div className="items">
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<Link href="Your Path"
style={{
textDecoration: "none",
color: "blue",
padding: "6px",
marginLeft: "10px",
}}
>
Colored Link
</Link>
</SistentThemeProvider>
</div>
<CodeBlock name="Colored-link" code={codes[1]} />
</div>

<h3>Underlined Link</h3>
<p>
Underlined Links, often referred to as ghost buttons, are styled primarily with text without any fills or borders. They utilize specific text styling and color to signify different states, making them easily identifiable and enhancing user navigation.
</p>
<div className="showcase">
<div className="items">
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<Link
href="Your Path"
style={{
textDecoration: "underline",
padding: "6px",
marginLeft: "10px",
}}
>
Underlined Link
</Link>
</SistentThemeProvider>
</div>
<CodeBlock name="underlined-link" code={codes[2]} />
</div>

<h3>Customized Link </h3>
<p>
Customized Links allow for distinct text styles and presentations that can enhance the user experience. By leveraging different styling properties, these links can be tailored to fit the design aesthetics of your application while maintaining functionality.
</p>
<div className="showcase">
<div className="items">
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<Link
href="Your Path"
style={{
textDecoration: "none",
color: "blue",
fontWeight: "bold",
fontSize: "16px",
padding: "6px",
marginLeft: "10px",
borderBottom: "2px dashed blue",
}}
>
Customized Link
</Link>
</SistentThemeProvider>
</div>
<CodeBlock name="customized-link" code={codes[3]} />
</div>
<a id="Security Considerations">
<h2>Security Considerations</h2>
</a>
<p>
When utilizing links we should use them with the target="_blank" attribute, it's essential to implement rel="noopener" or rel="noreferrer" to enhance security and user privacy
</p>
<div className="showcase">
<div className="items">
<SistentThemeProvider initialMode={isDark ? "dark" : "light"}>
<Link
href="https://your-link.com" // Replace with the actual link
target="_blank"
rel="noopener noreferrer"
style={{
textDecoration: "underline",
padding: "6px",
marginLeft: "10px",
}}
>
Visit Secure Link
</Link>
</SistentThemeProvider>
</div>
<CodeBlock name="secure_links" code={codes[4]} />
</div>
</div>
</div>
</SistentLayout>
);
};
Loading

0 comments on commit d373678

Please sign in to comment.