Skip to content
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

fix: Extend about component #38

Merged
merged 2 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/components/footer/FooterAbout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ export interface FooterAboutProps
extends FooterPartsPrimitiveProps<HTMLDivElement> {
entityLink?: string;
entityName?: string;
entityText?: string;
}

const FooterAbout = (props: React.PropsWithChildren<FooterAboutProps>) => {
const { className, children, entityLink, entityName, ...rest } = props;
const { className, children, entityLink, entityName, entityText, ...rest } = props;
if (children) {
<div {...rest} className={className}>
{props.children}
Expand All @@ -27,7 +28,7 @@ const FooterAbout = (props: React.PropsWithChildren<FooterAboutProps>) => {
),
)}
>
Built with <span>🧡</span> by the{" "}
{entityText ?? "Built with 🧡 by the "}{" "}
<a
href={entityLink ?? "https://bitcoindevs.xyz/"}
target="_blank"
Expand Down
8 changes: 5 additions & 3 deletions src/components/footer/FooterFeedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
export interface FooterFeedbackProps
extends FooterPartsPrimitiveProps<HTMLDivElement> {
feedbackLink: string;
enitityText?: string;

Check warning on line 9 in src/components/footer/FooterFeedback.tsx

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"enitity" should be "entity".
entityCtaText?: string;
}

const FooterFeedback = (
props: React.PropsWithChildren<FooterFeedbackProps>,
) => {
const { className, children, feedbackLink, ...rest } = props;
const { className, children, feedbackLink, enitityText="We'd love to hear your feedback on this project?", entityCtaText="Give feedback", ...rest } = props;
if (children) {
<div {...rest} className={props.className}>
{props.children}
Expand All @@ -27,14 +29,14 @@
),
)}
>
<span>We&apos;d love to hear your feedback on this project?</span>
<span>{enitityText}</span>

Check warning on line 32 in src/components/footer/FooterFeedback.tsx

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"enitity" should be "entity".
<a
href={feedbackLink}
target="_blank"
rel="noreferrer"
className="leading-none w-fit min-w-fit mx-auto text-base font-medium md:font-semibold py-4 px-5 rounded-[10px] text-[#FAFAFA] dark:text-[#292929] bg-[#292929] dark:bg-[#FAFAFA]"
>
Give Feedback
{entityCtaText}
</a>
</div>
);
Expand Down
4 changes: 3 additions & 1 deletion src/components/footer/FooterPublic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import clsx from "clsx";
export interface FooterPublicProps
extends FooterPartsPrimitiveProps<HTMLAnchorElement> {
dashboardLink: string;
entityText?: string;
}

const FooterPublic = ({
className,
dashboardLink,
entityText = "View our public visitor count",
...rest
}: FooterPublicProps) => {
return (
Expand All @@ -26,7 +28,7 @@ const FooterPublic = ({
)}
{...rest}
>
View our public visitor count
{entityText}
</a>
);
};
Expand Down
3 changes: 2 additions & 1 deletion src/utils/filter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
export function matchCharactersWithRegex(word: string, searchTerm: string) {
const escapedSearchTerm = searchTerm.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");

// Construct a regex pattern that enforces order but allows small gaps
const regexPattern = escapedSearchTerm
.split("")
.map((char) => `(?=.*${char})`)
.map((char, index) => (index === 0 ? char : `[^${char}]{0,2}${char}`)) // Allow at most 2 non-matching chars between each
.join("");

const regex = new RegExp(regexPattern, "i"); // 'i' flag for case-insensitive matching
Expand Down
Loading