Skip to content

Commit

Permalink
Merge pull request #5 from AccessiTech/modularize-content
Browse files Browse the repository at this point in the history
Modularize content
  • Loading branch information
AccessiT3ch authored Jan 28, 2025
2 parents 78a3dc4 + 82771d2 commit 8274be9
Show file tree
Hide file tree
Showing 15 changed files with 186 additions and 89 deletions.
14 changes: 8 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
<meta name="msapplication-starturl" content="/">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<link rel="icon" sizes="192x192" href="android-chrome-192x192.png">
<link rel="apple-touch-icon" sizes="192x192" href="android-chrome-192x192.png">
<link rel="icon" sizes="512x512" href="android-chrome-512x512">
<link rel="apple-touch-icon" sizes="512x512" href="android-chrome-512x512">
<link rel="icon" sizes="180x180" href="apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<link rel="icon" sizes="16x16" href="assets/favicon-16x16.png">
<link rel="icon" sizes="32x32" href="assets/favicon-32x32.png">
<link rel="icon" sizes="192x192" href="assets/android-chrome-192x192.png">
<link rel="apple-touch-icon" sizes="192x192" href="assets/android-chrome-192x192.png">
<link rel="icon" sizes="512x512" href="assets/android-chrome-512x512.png">
<link rel="apple-touch-icon" sizes="512x512" href="assets/android-chrome-512x512.png">
<link rel="icon" sizes="180x180" href="assets/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="180x180" href="assets/apple-touch-icon.png">
</head>

<body>
Expand Down
File renamed without changes
File renamed without changes
17 changes: 11 additions & 6 deletions src/Components/Header/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import { Col, Row } from "react-bootstrap";
import Translate from "../Translate/Translate";
import PropTypes from "prop-types";

function Header() {
function Header({ title, lead, disableTranslate }) {
return (
<header>
<Row>
<Col>
<h1>Know Your Rights</h1>
<Translate />
{/* <p className="lead">
If you are reading this, you have constitutional rights.
</p> */}
<h1>{title || "Know Your Rights"}</h1>
{!disableTranslate && <Translate />}
{lead && <p className="lead">{lead}</p>}
</Col>
</Row>
</header>
);
}

Header.propTypes = {
title: PropTypes.string,
lead: PropTypes.string,
disableTranslate: PropTypes.bool,
};

export default Header;
8 changes: 8 additions & 0 deletions src/Components/Resources/ResourceBtn.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from "prop-types";
import { Button } from "react-bootstrap";

function ResourceBtn({ source, data, setModalContent, setShowModal }) {
Expand Down Expand Up @@ -25,4 +26,11 @@ function ResourceBtn({ source, data, setModalContent, setShowModal }) {
);
}

ResourceBtn.prototype = {
source: PropTypes.string,
data: PropTypes.object,
setModalContent: PropTypes.func,
setShowModal: PropTypes.func,
};

export default ResourceBtn;
13 changes: 11 additions & 2 deletions src/Components/Resources/Resources.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import {
digitalResources,
printableResources,
} from "./content";
import PropTypes from "prop-types";



function Resources() {
function Resources({ hideDigitals, hidePrintables }) {
const [showModal, setShowModal] = useState(false);
const [modalContent, setModalContent] = useState(null);

return (
<section id="resources">
{!hideDigitals && (
<Row>
<Col>
<h2 id="digital-resources">Digital Resources</h2>
Expand All @@ -38,6 +39,8 @@ function Resources() {
</Row>
</Col>
</Row>
)}
{!hidePrintables && (
<Row>
<Col>
<h2 id="printable-resources">Printable Resources</h2>
Expand All @@ -56,6 +59,7 @@ function Resources() {
</Row>
</Col>
</Row>
)}
<Modal show={showModal} onHide={() => setShowModal(false)}>
<Modal.Header closeButton closeVariant="white">
<Modal.Title>{modalContent?.title}</Modal.Title>
Expand Down Expand Up @@ -93,4 +97,9 @@ function Resources() {
);
}

Resources.prototype = {
hideDigitals: PropTypes.bool,
hidePrintables: PropTypes.bool,
};

export default Resources;
87 changes: 21 additions & 66 deletions src/Components/Rights/Rights.jsx
Original file line number Diff line number Diff line change
@@ -1,63 +1,20 @@
import { Button, Col, Nav, Row, Tab } from "react-bootstrap";
import { attribution, leftColContent, rightColContent } from "./content";
import PropTypes from "prop-types";


const rightColContent = (
<>
<p>
I do not wish to speak with you, answer your questions, or sign or hand
you any documents based on my 5th Amendment rights under the United States
Constitution.
</p>
<p>
I do not give you permission to enter my home based on my 4th Amendment
rights under the United States Constitution unless you have a warrant to
enter, signed by a judge or magistrate with my name on it that you slide
under the door.
</p>
<p>
I do not give you permission to search any of my belongings based on my
4th Amendment rights.
</p>
<p>I choose to exercise my constitutional rights.</p>
</>
);

const leftColContent = (
<>
<h2>You have constitutional rights</h2>
<p>
<b>DO NOT OPEN THE DOOR</b> if an immigration agent is knocking on the
door.
</p>
<p>
<b>DO NOT ANSWER ANY QUESTIONS</b> from an immigration agent if they try
to talk to you. You have the right to remain silent.
</p>
<p>
<b>DO NOT SIGN ANYTHING</b> without first speaking to a lawyer. You have
the right to speak with a lawyer.
</p>
<p>
If you are outside of your home, ask the agent if you are free to leave
and if they say yes, leave calmly.
</p>
<p>
<b>GIVE THIS CARD TO THE AGENT.</b> If you are inside of your home, show
the card through the window or slide it under the door.
</p>
</>
);

function Rights() {
function Rights({ ctaUrl, ctaTitle, leftHeader, rightHeader }) {
return (
<section id="rights">
<Row>
<Col md={6}>{leftColContent}</Col>
<Col md={6}>
<h2>{leftHeader || "You have constitutional rights"}</h2>
{leftColContent}
</Col>
<Col md={6}>
<Tab.Container defaultActiveKey="translated" id="language-tabs">
<Row>
<Col>
<h2>To the agent</h2>
<h2>{rightHeader || "To the agent"}</h2>
</Col>
<Col style={{ width: "100%" }}>
<Nav variant="pills" className="justify-content-end">
Expand Down Expand Up @@ -90,36 +47,34 @@ function Rights() {
</Col>
</Row>
<Row>
<Col>
<p className="credit">
{`This is a digital version of the "Red Cards" created by `}
<a
href="https://www.ilrc.org/red-cards"
target="_blank"
rel="noopener noreferrer"
>
{`the Immigration Legal Resource Center`}
</a>
{`.`}
</p>
</Col>
<Col>{attribution}</Col>
</Row>
<Row>
<Col>
<Button
href="https://www.informedimmigrant.com/resources/detention-deportation/know-your-rights/"
href={
ctaUrl ||
"https://www.informedimmigrant.com/resources/detention-deportation/know-your-rights/"
}
target="_blank"
rel="noopener noreferrer"
variant="primary"
size="lg"
className="external-link"
>
More about YOUR RIGHTS
{ctaTitle || "More about YOUR RIGHTS"}
</Button>
</Col>
</Row>
</section>
);
}

Rights.prototype = {
ctaUrl: PropTypes.string,
ctaTitle: PropTypes.string,
leftHeader: PropTypes.string,
rightHeader: PropTypes.string,
};

export default Rights;
61 changes: 61 additions & 0 deletions src/Components/Rights/content.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@


export const rightColContent = (
<>
<p>
I do not wish to speak with you, answer your questions, or sign or hand
you any documents based on my 5th Amendment rights under the United States
Constitution.
</p>
<p>
I do not give you permission to enter my home based on my 4th Amendment
rights under the United States Constitution unless you have a warrant to
enter, signed by a judge or magistrate with my name on it that you slide
under the door.
</p>
<p>
I do not give you permission to search any of my belongings based on my
4th Amendment rights.
</p>
<p>I choose to exercise my constitutional rights.</p>
</>
);

export const leftColContent = (
<>
<p>
<b>DO NOT OPEN THE DOOR</b> if an immigration agent is knocking on the
door.
</p>
<p>
<b>DO NOT ANSWER ANY QUESTIONS</b> from an immigration agent if they try
to talk to you. You have the right to remain silent.
</p>
<p>
<b>DO NOT SIGN ANYTHING</b> without first speaking to a lawyer. You have
the right to speak with a lawyer.
</p>
<p>
If you are outside of your home, ask the agent if you are free to leave
and if they say yes, leave calmly.
</p>
<p>
<b>GIVE THIS CARD TO THE AGENT.</b> If you are inside of your home, show
the card through the window or slide it under the door.
</p>
</>
);

export const attribution = (
<p className="credit">
{`This is a digital version of the "Red Cards" created by `}
<a
href="https://www.ilrc.org/red-cards"
target="_blank"
rel="noopener noreferrer"
>
{`the Immigration Legal Resource Center`}
</a>
{`.`}
</p>
);
24 changes: 18 additions & 6 deletions src/Components/Share/Share.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import PropTypes from "prop-types";
import { Row, Col } from "react-bootstrap";

function Share() {
function Share({ siteUrl, linkText, shareTitle, shareText }) {
const url = siteUrl || "https://redcards.accessi.tech";
const text = linkText || url.slice(8);
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);

const shareHandler = (e) => {
e.preventDefault();

if (!isMobile) {
navigator.clipboard.writeText("https://redcards.accessi.tech");
navigator.clipboard.writeText(url);
alert("Link copied to clipboard");
return;
}

navigator
.share({
title: "Red Cards",
text: "Know Your Rights",
url: "https://redcards.accessi.tech",
title: shareTitle || document.title,
text: shareText || "Know Your Rights",
url,
})
.then(() => {
console.log("Thanks for sharing!");
Expand Down Expand Up @@ -45,12 +50,19 @@ function Share() {
src="/assets/qr.svg"
alt="QR code to this website"
/>
<p>redcards.accessi.tech</p>
<p>{text}</p>
</a>
</Col>
</Row>
</section>
);
}

Share.propTypes = {
siteUrl: PropTypes.string,
linkText: PropTypes.string,
shareTitle: PropTypes.string,
shareText: PropTypes.string,
};

export default Share;
14 changes: 11 additions & 3 deletions src/Components/Translate/Translate.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React, { useEffect } from "react";
import { Row, Col } from "react-bootstrap";
import "./Translate.scss";
import PropTypes from "prop-types";

function Translate() {
function Translate({ hideCredit }) {
useEffect(() => {
if (document.getElementById("google_translate_element") && !window.google) {
const script = document.createElement("script");
Expand All @@ -14,11 +15,18 @@ function Translate() {
});
return (
<Row>
<Col style={{ textAlign: "center", colorScheme: '#B11111' }}>
<div id="google_translate_element"></div>
<Col style={{ textAlign: "center" }}>
<div
id="google_translate_element"
className={hideCredit ? "hide-credit" : ""}
></div>
</Col>
</Row>
);
}

Translate.propTypes = {
hideCredit: PropTypes.bool,
};

export default Translate;
Loading

0 comments on commit 8274be9

Please sign in to comment.