Skip to content

Instantly share code, notes, and snippets.

@joe-nano
Forked from adrianhajdin/constants
Created December 5, 2023 11:48
Show Gist options
  • Save joe-nano/0c49bd9a8f88a0c120cee5a8b08b69d3 to your computer and use it in GitHub Desktop.
Save joe-nano/0c49bd9a8f88a0c120cee5a8b08b69d3 to your computer and use it in GitHub Desktop.

Revisions

  1. @adrianhajdin adrianhajdin created this gist Dec 9, 2022.
    37 changes: 37 additions & 0 deletions constants
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    import { createCampaign, dashboard, logout, payment, profile, withdraw } from '../assets';

    export const navlinks = [
    {
    name: 'dashboard',
    imgUrl: dashboard,
    link: '/',
    },
    {
    name: 'campaign',
    imgUrl: createCampaign,
    link: '/create-campaign',
    },
    {
    name: 'payment',
    imgUrl: payment,
    link: '/',
    disabled: true,
    },
    {
    name: 'withdraw',
    imgUrl: withdraw,
    link: '/',
    disabled: true,
    },
    {
    name: 'profile',
    imgUrl: profile,
    link: '/profile',
    },
    {
    name: 'logout',
    imgUrl: logout,
    link: '/',
    disabled: true,
    },
    ];
    18 changes: 18 additions & 0 deletions index.css
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    @import url("https://fonts.googleapis.com/css2?family=Epilogue:wght@400;500;600;700&display=swap");

    @tailwind base;
    @tailwind components;
    @tailwind utilities;

    .linear-gradient {
    background: linear-gradient(
    179.14deg,
    rgba(32, 18, 63, 0) -7.14%,
    #000000 87.01%
    );
    }

    input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(0.8);
    }
    18 changes: 18 additions & 0 deletions tailwind.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    /** @type {import('tailwindcss').Config} */
    module.exports = {
    content: [
    "./index.html",
    "./src/**/*.{js,ts,jsx,tsx}",
    ],
    theme: {
    extend: {
    fontFamily: {
    epilogue: ['Epilogue', 'sans-serif'],
    },
    boxShadow: {
    secondary: '10px 10px 20px rgba(2, 2, 2, 0.25)',
    },
    },
    },
    plugins: [],
    }
    22 changes: 22 additions & 0 deletions utils
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    export const daysLeft = (deadline) => {
    const difference = new Date(deadline).getTime() - Date.now();
    const remainingDays = difference / (1000 * 3600 * 24);

    return remainingDays.toFixed(0);
    };

    export const calculateBarPercentage = (goal, raisedAmount) => {
    const percentage = Math.round((raisedAmount * 100) / goal);

    return percentage;
    };

    export const checkIfImage = (url, callback) => {
    const img = new Image();
    img.src = url;

    if (img.complete) callback(true);

    img.onload = () => callback(true);
    img.onerror = () => callback(false);
    };