Merge pull request #23 from arifszn/migrate-to-vite

Migrate to vite.js
This commit is contained in:
Ariful Alam 2022-03-20 00:50:47 +06:00 committed by GitHub
commit 5c9f17d5f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 8259 additions and 41684 deletions

View File

@ -1,39 +0,0 @@
name: Build and Publish to gh-pages Branch
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
env:
CI: ""
- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.4
with:
branch: gh-pages
folder: build

38
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: Deploy to gh-pages Branch
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
env:
CI: ''
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: build

41
.gitignore vendored
View File

@ -1,23 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@ -198,4 +198,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.

171
README.md
View File

@ -36,63 +36,58 @@ It's all possible using [GitHub API](https://developer.github.com/v3/) (for auto
To view a live example, **[click here](https://arifszn.github.io/ezprofile)**.
## 🛠 Installation & Set Up
These instructions will get you a copy of the project and deploy your website online!
- **[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo)** the repo so you have your own project to customize by clicking the fork icon on the top right side. A "fork" is a copy of a repository.
- Rename your forked repository to `username.github.io` in github, where `username` is your GitHub username (or organization name).
- Go to your repo's **Actions** page and enable workflows.
![Workflows](https://arifszn.github.io/assets/img/hosted/ezprofile/workflows.png)
- **[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo)** the repo so you have your own project to customize by clicking the fork icon on the top right side. A "fork" is a copy of a repository.
- Rename your forked repository to `username.github.io` in github, where `username` is your GitHub username (or organization name).
- Go to your repo's **Actions** page and enable workflows.
- Open `package.json`, and change `homepage`'s value to `https://username.github.io`.
```js
// package.json
{
// ...
"homepage": "https://username.github.io",
}
```
![Workflows](https://arifszn.github.io/assets/img/hosted/ezprofile/workflows.png)
- Now commit to your **main** branch with your changes.
- The CI/CD pipeline will publish your page at the gh-pages branch automatically.
- Go to your repo's **Settings** -> **Pages** -> **Source** and change the branch to gh-pages and click **save**.
- Your personal portfolio will be live at `username.github.io`.
- Any time you commit a change to the **main** branch, the website will be automatically updated.
- Open `package.json`, and change `homepage`'s value to `https://username.github.io`.
```js
// package.json
{
// ...
"homepage": "https://username.github.io",
}
```
- Now commit to your **main** branch with your changes.
- The CI/CD pipeline will publish your page at the gh-pages branch automatically.
- Go to your repo's **Settings** -> **Pages** -> **Source** and change the branch to gh-pages and click **save**.
- Your personal portfolio will be live at `username.github.io`.
- Any time you commit a change to the **main** branch, the website will be automatically updated.
You can skip the above steps and do a manual deployment by running `npm run deploy`. For more info, visit [here](https://create-react-app.dev/docs/deployment/#github-pages).
If you see only `README` at `username.github.io`, be sure to change your GitHub Page's source to `gh-pages` branch. See [how to](https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site). Also, if you face any issue rendering the website, double-check the `homepage` value in the `package.json`. It must be the value matching the repository name.
As this is a create react app, you can also host your website to Netlify, Vercel, Heroku, or other popular services. Please refer to this [doc](https://create-react-app.dev/docs/deployment) for a detailed deployment guide to other services.
## 🎨 Customization
All the magic happens in the file `src/config.js`. Open it and modify it according to your preference.
All the magic happens in the file `src/ezprofile.config.js`. Open it and modify it according to your preference.
These are the default values:
<details>
<summary>config.js</summary>
<summary>ezprofile.config.js</summary>
```js
// config.js
module.exports = {
// ezprofile.config.js
const config = {
github: {
username: 'arifszn', // Your GitHub org/user name. (Required)
sortBy: 'stars', // stars | updated
limit: 8, // How many projects to display.
exclude: {
forks: false, // Forked projects will not be displayed if set to true.
projects: [] // These projects will not be displayed. example: ['my-project1', 'my-project2']
}
projects: [], // These projects will not be displayed. example: ['my-project1', 'my-project2']
},
},
social: {
linkedin: '',
@ -104,53 +99,50 @@ module.exports = {
devto: '',
website: '',
phone: '',
email: ''
email: '',
},
skills: [
'JavaScript',
'React.js',
],
skills: ['JavaScript', 'React.js'],
experiences: [
{
company: 'Company name 1',
position: 'Software Engineer',
from: 'July 2019',
to: 'Present'
to: 'Present',
},
{
company: 'Company name 2',
position: 'Jr. Software Engineer',
from: 'January 2019',
to: ' June 2019'
}
to: ' June 2019',
},
],
education: [
{
institution: 'Institution name 1',
degree: 'Bachelor of Science',
from: '2015',
to: '2019'
to: '2019',
},
{
institution: 'Institution name 2',
degree: 'Higher Secondary Certificate (HSC)',
from: '2012',
to: '2014',
}
},
],
blog: {
// Display blog posts from your medium or dev.to account. (Optional)
source: 'dev.to', // medium | dev.to
username: 'arifszn',
limit: 5 // How many posts to display. Max is 10.
limit: 5, // How many posts to display. Max is 10.
},
googleAnalytics: {
// GA3 tracking id/GA4 tag id
id: '' // UA-XXXXXXXXX-X | G-XXXXXXXXXX
id: '', // UA-XXXXXXXXX-X | G-XXXXXXXXXX
},
hotjar: {
id: '',
snippetVersion : 6
snippetVersion: 6,
},
themeConfig: {
default: 'light',
@ -185,29 +177,29 @@ module.exports = {
'wireframe',
'black',
'luxury',
'dracula'
]
}
}
'dracula',
],
},
};
```
</details>
</details>
### Themes
There are 21 themes available that can be selected from the dropdown.
There are 21 themes available that can be selected from the dropdown.
The default theme can be specified.
```js
// config.js
// ezprofile.config.js
module.exports = {
// ...
themeConfig: {
default: 'light',
// ...
}
}
},
};
```
![Theme Dropdown](https://arifszn.github.io/assets/img/hosted/ezprofile/themes-1.png)
@ -220,18 +212,18 @@ Here are some screenshots of different themes.\
<br/>
![Themes](https://arifszn.github.io/assets/img/hosted/ezprofile/themes-7.png)
### Google Analytics
ezFolio supports both GA3 and GA4. If you do not want to use Google Analytics, keep the `id` empty.
```js
// config.js
// ezprofile.config.js
module.exports = {
// ...
googleAnalytics: {
id: ''
id: '',
},
}
};
```
Besides tracking visitors, ezFolio will track click events on projects and blog posts, and send them to Google Analytics.\
@ -243,33 +235,32 @@ Besides tracking visitors, ezFolio will track click events on projects and blog
ezProfile supports hotjar. If you do not want to use Hotjar, keep the `id` empty.
```js
// config.js
// ezprofile.config.js
module.exports = {
// ...
hotjar: {
id: '',
snippetVersion : 6
snippetVersion: 6,
},
}
};
```
### Meta Tags
Meta tags will be auto-generated from configs dynamically. However, you can also manually add meta tags in `public\index.html`.
### Avatar and Bio
Your github avatar and bio will be displayed here.\
<br/>
![Avatar Bio](https://arifszn.github.io/assets/img/hosted/ezprofile/avatar-card.png)
### Social Links
ezProfile supports linking your social media services you're using, including LinkedIn, Twitter, Facebook, Dribbble, Behance, Medium, dev.to, personal website, phone and email.
```js
// config.js
// ezprofile.config.js
module.exports = {
// ...
social: {
@ -282,34 +273,31 @@ module.exports = {
devto: '',
website: 'https://arifszn.github.io',
phone: '',
email: ''
email: '',
},
}
};
```
### Skills
To showcase your skills provide them here.
```js
// config.js
// ezprofile.config.js
module.exports = {
// ...
skills: [
'JavaScript',
'React.js',
],
}
skills: ['JavaScript', 'React.js'],
};
```
Empty array will hide the skills section.
### Experience
Provide your job history in `experiences`.
```js
// config.js
// ezprofile.config.js
module.exports = {
// ...
experiences: [
@ -317,26 +305,26 @@ module.exports = {
company: 'Company name 1',
position: 'Software Engineer',
from: 'July 2019',
to: 'Present'
to: 'Present',
},
{
company: 'Company name 2',
position: 'Jr. Software Engineer',
from: 'January 2019',
to: ' June 2019'
}
to: ' June 2019',
},
],
}
};
```
Empty array will hide the experience section.
### Education
Provide your education history in `education`.
```js
// config.js
// ezprofile.config.js
module.exports = {
// ...
education: [
@ -344,27 +332,26 @@ module.exports = {
institution: 'Institution name 1',
degree: 'Bachelor of Science',
from: '2015',
to: '2019'
to: '2019',
},
{
institution: 'Institution name 2',
degree: 'Higher Secondary Certificate (HSC)',
from: '2012',
to: '2014',
}
},
],
}
};
```
Empty array will hide the education section.
### Projects
Your public repo from github will be displayed here automatically. You can limit how many projects do you want to be displayed. Also, you can hide forked or specific repo.
```js
// config.js
// ezprofile.config.js
module.exports = {
// ...
github: {
@ -373,10 +360,10 @@ module.exports = {
limit: 8,
exclude: {
forks: false,
projects: ['my-project1', 'my-project2']
}
projects: ['my-project1', 'my-project2'],
},
},
}
};
```
### Blog Posts
@ -384,35 +371,31 @@ module.exports = {
If you have [medium](https://medium.com) or [dev.to](https://dev.to) account, you can show your recent blog posts in here just by providing your medium/dev.to username. You can limit how many posts to display (Max is `10`).
```js
// config.js
// ezprofile.config.js
module.exports = {
// ...
blog: {
source: 'dev.to',
username: 'arifszn',
limit: 5
limit: 5,
},
}
};
```
![Blog](https://arifszn.github.io/assets/img/hosted/ezprofile/blog.png)
The posts are fetched by [Article-api](https://github.com/arifszn/article-api).
## 📢 Please Read
I intend to keep my works open source. Please do not discourage me by claiming this work by copying it as your own. However, You are open to use this project by forking it and change any code necessary by giving attribute to the original author. Please see this [issue](https://github.com/arifszn/ezprofile/issues/11) for more info.
## 💖 Support
<a href="https://www.buymeacoffee.com/arifszn" target="_blank">
<img src="https://raw.githubusercontent.com/arifszn/arifszn/main/assets/bmc-button.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" >
</a>
## 💡 Contributing
Any contributors who want to make this project better can make contributions, which will be greatly appreciated. To contribute, clone this repo locally and commit your code to a new branch. Feel free to create an issue or make a pull request.

View File

@ -1,10 +0,0 @@
module.exports = {
style: {
postcss: {
plugins: [
require('tailwindcss'),
require('autoprefixer'),
],
},
},
}

15
index.html Normal file
View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="manifest" href="/manifest.json" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Portfolio</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>

43336
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,79 +1,55 @@
{
"name": "ezprofile",
"version": "1.1.1",
"description": "Kickstart your personal portfolio with Github Api and blog",
"homepage": "https://arifszn.github.io/ezprofile",
"private": true,
"license": "Apache-2.0",
"author": "arifszn",
"repository": {
"type": "git",
"url": "https://github.com/arifszn/ezprofile.git"
},
"dependencies": {
"@craco/craco": "^6.2.0",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"article-api": "^1.0.5",
"axios": "^0.23.0",
"daisyui": "^1.12.1",
"gh-pages": "^3.2.3",
"moment": "^2.29.1",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-helmet-async": "^1.1.0",
"react-hotjar": "^3.0.1",
"react-icons": "^4.2.0",
"react-scripts": "4.0.3",
"sass": "^1.38.0",
"web-vitals": "^1.0.1"
},
"scripts": {
"start": "craco start",
"build": "craco build",
"test": "craco test",
"eject": "react-scripts eject",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"autoprefixer": "^9.8.6",
"postcss": "^7.0.36",
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.7"
},
"keywords": [
"personal-site",
"template",
"portfolio",
"personal-website",
"portfolio-website",
"portfolio-site",
"portfolio-template",
"portfolio-page",
"developer-portfolio",
"portfolio-project",
"github-portfolio",
"react-portfolio",
"github-api"
]
"name": "ezprofile",
"description": "Kickstart your personal portfolio with Github Api and blog",
"private": true,
"version": "1.1.1",
"homepage": "https://arifszn.github.io/ezprofile",
"license": "Apache-2.0",
"author": "arifszn",
"repository": {
"type": "git",
"url": "https://github.com/arifszn/ezprofile.git"
},
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
},
"dependencies": {
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@vitejs/plugin-react": "^1.0.7",
"article-api": "^1.0.8",
"autoprefixer": "^10.4.4",
"axios": "^0.26.1",
"daisyui": "^2.11.0",
"gh-pages": "^3.2.3",
"moment": "^2.29.1",
"postcss": "^8.4.12",
"prop-types": "^15.8.1",
"react-helmet-async": "^1.2.3",
"react-hotjar": "^5.0.0",
"react-icons": "^4.3.1",
"tailwindcss": "^3.0.23",
"vite": "^2.8.0"
},
"keywords": [
"personal-site",
"template",
"portfolio",
"personal-website",
"portfolio-website",
"portfolio-site",
"portfolio-template",
"portfolio-page",
"developer-portfolio",
"portfolio-project",
"github-portfolio",
"react-portfolio",
"github-api"
]
}

6
postcss.config.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/apple-touch-icon.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>Portfolio</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>

View File

@ -1,178 +0,0 @@
import axios from "axios";
import { Fragment, useCallback, useContext, useEffect, useState } from "react";
import AvatarCard from "./components/AvatarCard";
import ErrorPage from "./components/ErrorPage";
import ThemeChanger from "./components/ThemeChanger";
import config from "./config";
import moment from 'moment';
import Details from "./components/Details";
import Skill from "./components/Skill";
import Experience from "./components/Experience";
import Education from "./components/Education";
import Project from "./components/Project";
import Blog from "./components/Blog";
import MetaTags from "./components/MetaTags";
import { LoadingContext } from "./contexts/LoadingContext";
import { ThemeContext } from "./contexts/ThemeContext";
function App() {
const [theme] = useContext(ThemeContext);
const [, setLoading] = useContext(LoadingContext);
const [profile, setProfile] = useState(null);
const [repo, setRepo] = useState(null);
const [error, setError] = useState(null);
const [rateLimit, setRateLimit] = useState(null);
useEffect(() => {
if (theme) {
document.documentElement.setAttribute('data-theme', theme);
}
}, [theme])
const loadData = useCallback(() => {
axios.get(`https://api.github.com/users/${config.github.username}`)
.then(response => {
let data = response.data;
let profileData = {
avatar: data.avatar_url,
name: data.name ? data.name : '',
bio: data.bio ? data.bio : '',
location: data.location ? data.location : '',
company: data.company ? data.company : ''
}
setProfile(profileData);
})
.then(() => {
let excludeRepo = ``;
config.github.exclude.projects.forEach(project => {
excludeRepo += `+-repo:${config.github.username}/${project}`;
});
let query = `user:${config.github.username}+fork:${!config.github.exclude.forks}${excludeRepo}`;
let url = `https://api.github.com/search/repositories?q=${query}&sort=${config.github.sortBy}&per_page=${config.github.limit}&type=Repositories`;
axios.get(url, {
headers: {
'Content-Type': 'application/vnd.github.v3+json'
}
})
.then(response => {
let data = response.data;
setRepo(data.items);
})
.catch((error) => {
handleError(error);
});
})
.catch((error) => {
handleError(error);
})
.finally(() => {
setLoading(false);
});
}, [setLoading])
useEffect(() => {
loadData();
}, [loadData])
const handleError = (error) => {
console.error('Error:', error);
try {
setRateLimit({
remaining: error.response.headers['x-ratelimit-remaining'],
reset: moment(new Date(error.response.headers['x-ratelimit-reset'] * 1000)).fromNow(),
});
if (error.response.status === 403) {
setError(429);
} else if (error.response.status === 404) {
setError(404);
} else {
setError(500);
}
} catch (error2) {
setError(500);
}
}
return (
<Fragment>
<MetaTags profile={profile}/>
<div className="fade-in h-screen">
{
error ? (
<ErrorPage
status={`${error}`}
title={(error === 404) ? 'The Github Username is Incorrect' : (
error === 429 ? 'Too Many Requests.' : `Ops!!`
)}
subTitle={
(error === 404) ? (
<p>
Please provide correct github username in <code>src\config.js</code>
</p>
) : (
error === 429 ? (
<p>
Oh no, you hit the{' '}
<a
href="https://developer.github.com/v3/rate_limit/"
target="_blank"
rel="noopener noreferrer"
>
rate limit
</a>
! Try again later{rateLimit && ` ${rateLimit.reset}`}.
</p>
) : `Something went wrong`
)
}
/>
) : (
<Fragment>
<div className="p-4 lg:p-10 min-h-full bg-base-200">
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6 rounded-box">
<div className="col-span-1">
<div className="grid grid-cols-1 gap-6">
{
!config.themeConfig.disableSwitch && (
<ThemeChanger/>
)
}
<AvatarCard profile={profile}/>
<Details profile={profile}/>
<Skill/>
<Experience/>
<Education/>
</div>
</div>
<div className="lg:col-span-2 col-span-1">
<div className="grid grid-cols-1 gap-6">
<Project repo={repo}/>
<Blog/>
</div>
</div>
</div>
</div>
{/* DO NOT REMOVE/MODIFY THE FOOTER. FOR MORE INFO https://github.com/arifszn/ezprofile#-please-read */}
<footer className="p-4 footer bg-base-200 text-base-content footer-center">
<div>
<p className="font-mono text-sm">Made with <a className="text-primary" href="https://github.com/arifszn/ezprofile" target="_blank" rel="noreferrer">ezProfile</a> and </p>
</div>
</footer>
</Fragment>
)
}
</div>
</Fragment>
);
}
export default App;

205
src/App.jsx Normal file
View File

@ -0,0 +1,205 @@
import axios from 'axios';
import { Fragment, useCallback, useEffect, useState } from 'react';
import moment from 'moment';
import config from './ezprofile.config';
import HeadTagEditor from './components/head-tag-editor';
import ErrorPage from './components/error-page';
import ThemeChanger from './components/theme-changer';
import AvatarCard from './components/avatar-card';
import Details from './components/details';
import Skill from './components/skill';
import Experience from './components/experience';
import Education from './components/education';
import Project from './components/project';
import Blog from './components/blog';
import { getInitialTheme, setupHotjar } from './helpers/utils';
function App() {
const [theme, setTheme] = useState(getInitialTheme());
const [loading, setLoading] = useState(true);
const [profile, setProfile] = useState(null);
const [repo, setRepo] = useState(null);
const [error, setError] = useState(null);
const [rateLimit, setRateLimit] = useState(null);
useEffect(() => {
if (theme) {
document.documentElement.setAttribute('data-theme', theme);
}
}, [theme]);
useEffect(() => {
setupHotjar();
}, []);
const loadData = useCallback(() => {
axios
.get(`https://api.github.com/users/${config.github.username}`)
.then((response) => {
let data = response.data;
let profileData = {
avatar: data.avatar_url,
name: data.name ? data.name : '',
bio: data.bio ? data.bio : '',
location: data.location ? data.location : '',
company: data.company ? data.company : '',
};
setProfile(profileData);
})
.then(() => {
let excludeRepo = ``;
config.github.exclude.projects.forEach((project) => {
excludeRepo += `+-repo:${config.github.username}/${project}`;
});
let query = `user:${config.github.username}+fork:${!config.github
.exclude.forks}${excludeRepo}`;
let url = `https://api.github.com/search/repositories?q=${query}&sort=${config.github.sortBy}&per_page=${config.github.limit}&type=Repositories`;
axios
.get(url, {
headers: {
'Content-Type': 'application/vnd.github.v3+json',
},
})
.then((response) => {
let data = response.data;
setRepo(data.items);
})
.catch((error) => {
handleError(error);
});
})
.catch((error) => {
handleError(error);
})
.finally(() => {
setLoading(false);
});
}, [setLoading]);
useEffect(() => {
loadData();
}, [loadData]);
const handleError = (error) => {
console.error('Error:', error);
try {
setRateLimit({
remaining: error.response.headers['x-ratelimit-remaining'],
reset: moment(
new Date(error.response.headers['x-ratelimit-reset'] * 1000)
).fromNow(),
});
if (error.response.status === 403) {
setError(429);
} else if (error.response.status === 404) {
setError(404);
} else {
setError(500);
}
} catch (error2) {
setError(500);
}
};
return (
<Fragment>
<HeadTagEditor profile={profile} theme={theme} />
<div className="fade-in h-screen">
{error ? (
<ErrorPage
status={`${error}`}
title={
error === 404
? 'The Github Username is Incorrect'
: error === 429
? 'Too Many Requests.'
: `Ops!!`
}
subTitle={
error === 404 ? (
<p>
Please provide correct github username in{' '}
<code>src/ezprofile.config.js</code>
</p>
) : error === 429 ? (
<p>
Oh no, you hit the{' '}
<a
href="https://developer.github.com/v3/rate_limit/"
target="_blank"
rel="noopener noreferrer"
>
rate limit
</a>
! Try again later{rateLimit && ` ${rateLimit.reset}`}.
</p>
) : (
`Something went wrong`
)
}
/>
) : (
<Fragment>
<div className="p-4 lg:p-10 min-h-full bg-base-200">
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6 rounded-box">
<div className="col-span-1">
<div className="grid grid-cols-1 gap-6">
{!config.themeConfig.disableSwitch && (
<ThemeChanger
theme={theme}
setTheme={setTheme}
loading={loading}
/>
)}
<AvatarCard profile={profile} loading={loading} />
<Details profile={profile} loading={loading} />
<Skill loading={loading} />
<Experience loading={loading} />
<Education loading={loading} />
</div>
</div>
<div className="lg:col-span-2 col-span-1">
<div className="grid grid-cols-1 gap-6">
<Project repo={repo} loading={loading} />
<Blog loading={loading} />
</div>
</div>
</div>
</div>
{/* DO NOT REMOVE/MODIFY THE FOOTER. FOR MORE INFO https://github.com/arifszn/ezprofile#-please-read */}
<footer className="p-4 footer bg-base-200 text-base-content footer-center">
<div className="card compact bg-base-100 shadow">
<div className="card-body">
<div>
<p className="font-mono text-sm">
Made with{' '}
<a
className="text-primary"
href="https://github.com/arifszn/ezprofile"
target="_blank"
rel="noreferrer"
>
ezProfile
</a>{' '}
and
</p>
</div>
</div>
</div>
</footer>
</Fragment>
)}
</div>
</Fragment>
);
}
export default App;

View File

@ -1,8 +0,0 @@
import { render, screen } from '@testing-library/react';
import App from './App';
test('renders learn react link', () => {
render(<App />);
const linkElement = screen.getByText(/learn react/i);
expect(linkElement).toBeInTheDocument();
});

View File

@ -1,71 +0,0 @@
import { fallbackImage, skeleton } from "../helpers/utils";
import LazyImage from "./LazyImage";
import PropTypes from 'prop-types';
import { useContext } from "react";
import { LoadingContext } from "../contexts/LoadingContext";
const AvatarCard = (props) => {
const [loading] = useContext(LoadingContext);
return (
<div className="card shadow-lg compact bg-base-100">
<div className="grid place-items-center py-8">
{
(loading || !props.profile) ? (
<div className="avatar opacity-90">
<div className="mb-8 rounded-full w-32 h-32">
{
skeleton({
width: 'w-full',
height: 'h-full',
shape: '',
})
}
</div>
</div>
) : (
<div className="avatar opacity-90">
<div className="mb-8 rounded-full w-32 h-32 ring ring-primary ring-offset-base-100 ring-offset-2">
{
<LazyImage
src={props.profile.avatar ? props.profile.avatar : fallbackImage}
alt={props.profile.name}
placeholder={
skeleton({
width: 'w-full',
height: 'h-full',
shape: '',
})
}
/>
}
</div>
</div>
)
}
<div className="text-center mx-auto px-8">
<h5 className="font-bold text-2xl">
{
(loading || !props.profile) ? (
skeleton({ width: 'w-48', height: 'h-8' })
) : <span className="opacity-70">{props.profile.name}</span>
}
</h5>
<div className="mt-3 text-base-content text-opacity-60">
{
(loading || !props.profile) ? (
skeleton({ width: 'w-48', height: 'h-5' })
) : props.profile.bio
}
</div>
</div>
</div>
</div>
)
}
AvatarCard.propTypes = {
profile: PropTypes.object
}
export default AvatarCard;

View File

@ -1,197 +0,0 @@
import { getDevtoArticle, getMediumArticle } from "article-api";
import moment from "moment";
import { Fragment, useContext, useEffect, useState } from "react";
import { CgHashtag } from 'react-icons/cg';
import config from "../config";
import { LoadingContext } from "../contexts/LoadingContext";
import { ga, skeleton } from "../helpers/utils";
import LazyImage from "./LazyImage";
const displaySection = () => {
if (
typeof config.blog !== 'undefined' &&
typeof config.blog.source !== 'undefined' &&
typeof config.blog.username !== 'undefined' &&
config.blog.source &&
config.blog.username
) {
return true;
} else {
return false;
}
}
const Blog = () => {
const [articles, setArticles] = useState(null);
const [loading] = useContext(LoadingContext);
useEffect(() => {
if (displaySection()) {
if (config.blog.source === 'medium') {
getMediumArticle({
user: config.blog.username
})
.then(res => {
setArticles(res);
});
} else if (config.blog.source === 'dev.to') {
getDevtoArticle({
user: config.blog.username
})
.then(res => {
setArticles(res);
});
}
}
}, [])
const renderSkeleton = () => {
let array = [];
for (let index = 0; index < config.blog.limit; index++) {
array.push((
<div className="card shadow-lg compact bg-base-100" key={index}>
<div className="p-8 h-full w-full">
<div className="flex items-center flex-col md:flex-row">
<div className="avatar mb-5 md:mb-0">
<div className="w-24 h-24 mask mask-squircle">
{
skeleton({
width: 'w-full',
height: 'h-full',
shape: '',
})
}
</div>
</div>
<div className="w-full">
<div className="flex items-start px-4">
<div className="w-full">
<h2>
{skeleton({ width: 'w-full', height: 'h-8', className: 'mb-2 mx-auto md:mx-0' })}
</h2>
{skeleton({ width: 'w-24', height: 'h-3', className: 'mx-auto md:mx-0' })}
<div className="mt-3">
{skeleton({ width: 'w-full', height: 'h-4', className: 'mx-auto md:mx-0' })}
</div>
<div className="mt-4 flex items-center flex-wrap justify-center md:justify-start">
{skeleton({ width: 'w-32', height: 'h-4', className: "md:mr-2 mx-auto md:mx-0" })}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
))
}
return array;
}
const renderArticles = () => {
return articles && articles.slice(0, config.blog.limit).map((article, index) => (
<div
className="card shadow-lg compact bg-base-100 cursor-pointer"
key={index}
onClick={() => {
try {
if (config.googleAnalytics?.id) {
ga.event({
action: "Click Blog Post",
params: {
post: article.title
}
});
}
} catch (error) {
console.error(error);
}
window.open(article.link, '_blank')
}}
>
<div className="p-8 h-full w-full">
<div className="flex items-center flex-col md:flex-row">
<div className="avatar mb-5 md:mb-0 opacity-90">
<div className="w-24 h-24 mask mask-squircle">
<LazyImage
src={article.thumbnail}
alt={'thumbnail'}
placeholder={
skeleton({
width: 'w-full',
height: 'h-full',
shape: '',
})
}
/>
</div>
</div>
<div className="w-full">
<div className="flex items-start px-4">
<div className="text-center md:text-left w-full">
<h2 className="font-semibold text-base-content opacity-60">{article.title}</h2>
<p className="opacity-50 text-xs">
{moment(article.publishedAt).fromNow()}
</p>
<p className="mt-3 text-base-content text-opacity-60 text-sm">
{article.description}
</p>
<div className="mt-4 flex items-center flex-wrap justify-center md:justify-start">
{
article.categories.map((category, index2) => (
<div key={index2} className="flex text-sm mr-3 items-center opacity-50 font-bold font-mono">
<span><CgHashtag /></span>
<span>{category}</span>
</div>
))
}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
))
}
return (
<Fragment>
{
displaySection() && (
<div className="col-span-1 lg:col-span-2">
<div className="grid grid-cols-2 gap-6">
<div className="col-span-2">
<div className="card compact bg-base-100 shadow-sm">
<div className="card-body">
<ul className="menu row-span-3 bg-base-100 text-base-content">
<li>
<div className="pb-0-important mx-4 flex items-center justify-between">
<h5 className="card-title">
{
(loading || !articles) ? skeleton({ width: 'w-28', height: 'h-8' }) : (
<span className="opacity-70">Recent Posts</span>
)
}
</h5>
</div>
</li>
</ul>
</div>
</div>
</div>
<div className="col-span-2">
<div className="grid grid-cols-1 gap-6">
{(loading || !articles) ? renderSkeleton() : renderArticles()}
</div>
</div>
</div>
</div>
)
}
</Fragment>
)
}
export default Blog;

View File

@ -1,307 +0,0 @@
import { MdLocationOn, MdMail } from 'react-icons/md';
import { AiFillGithub, AiFillMediumSquare } from 'react-icons/ai';
import { SiTwitter } from 'react-icons/si';
import { GrLinkedinOption } from 'react-icons/gr';
import { CgDribbble } from 'react-icons/cg';
import { RiPhoneFill } from 'react-icons/ri';
import { FaBehanceSquare, FaBuilding, FaDev, FaFacebook, FaGlobe } from 'react-icons/fa';
import config from '../config';
import { skeleton } from '../helpers/utils';
import PropTypes from 'prop-types';
import { useContext } from 'react';
import { LoadingContext } from '../contexts/LoadingContext';
const Details = (props) => {
const [loading] = useContext(LoadingContext);
const renderSkeleton = () => {
let array = [];
for (let index = 0; index < 4; index++) {
array.push((
<li key={index}>
<span>
{skeleton({ width: 'w-6', height: 'h-4', className: 'mr-2' })}
{skeleton({ width: 'w-32', height: 'h-4' })}
</span>
</li>
))
}
return array;
}
return (
<div className="card shadow-lg compact bg-base-100">
<div className="card-body">
<ul className="menu row-span-3 bg-base-100 text-base-content text-opacity-60">
{
(loading || !props.profile) ? renderSkeleton() : (
<>
{
props.profile.location && (
<li>
<span>
<div>
<MdLocationOn className="mr-2"/>
</div>
<div>
{props.profile.location}
</div>
</span>
</li>
)
}
{
props.profile.company && (
<li>
<span>
<div>
<FaBuilding className="mr-2"/>
</div>
<div>
{props.profile.company}
</div>
</span>
</li>
)
}
<li>
<span>
<div>
<AiFillGithub className="mr-2"/>
</div>
<div>
<a
href={`https://github.com/${config.github.username}`}
target="_blank"
rel="noreferrer"
className="text-base-content-important"
>
{config.github.username}
</a>
</div>
</span>
</li>
{
typeof config.social.linkedin !== 'undefined' && config.social.linkedin && (
<li>
<span>
<div>
<GrLinkedinOption className="mr-2"/>
</div>
<div>
<a
href={`https://www.linkedin.com/in/${config.social.linkedin}`}
target="_blank"
rel="noreferrer"
className="text-base-content-important"
>
{config.social.linkedin}
</a>
</div>
</span>
</li>
)
}
{
typeof config.social.twitter !== 'undefined' && config.social.twitter && (
<li>
<span>
<div>
<SiTwitter className="mr-2"/>
</div>
<div>
<a
href={`https://twitter.com/${config.social.twitter}`}
target="_blank"
rel="noreferrer"
className="text-base-content-important"
>
{config.social.twitter}
</a>
</div>
</span>
</li>
)
}
{
typeof config.social.dribbble !== 'undefined' && config.social.dribbble && (
<li>
<span>
<div>
<CgDribbble className="mr-2"/>
</div>
<div>
<a
href={`https://dribbble.com/${config.social.dribbble}`}
target="_blank"
rel="noreferrer"
className="text-base-content-important"
>
{config.social.dribbble}
</a>
</div>
</span>
</li>
)
}
{
typeof config.social.behance !== 'undefined' && config.social.behance && (
<li>
<span>
<div>
<FaBehanceSquare className="mr-2"/>
</div>
<div>
<a
href={`https://www.behance.net/${config.social.behance}`}
target="_blank"
rel="noreferrer"
className="text-base-content-important"
>
{config.social.behance}
</a>
</div>
</span>
</li>
)
}
{
typeof config.social.facebook !== 'undefined' && config.social.facebook && (
<li>
<span>
<div>
<FaFacebook className="mr-2"/>
</div>
<div>
<a
href={`https://www.facebook.com/${config.social.facebook}`}
target="_blank"
rel="noreferrer"
className="text-base-content-important"
>
{config.social.facebook}
</a>
</div>
</span>
</li>
)
}
{
typeof config.social.medium !== 'undefined' && config.social.medium && (
<li>
<span>
<div>
<AiFillMediumSquare className="mr-2"/>
</div>
<div>
<a
href={`https://medium.com/@${config.social.medium}`}
target="_blank"
rel="noreferrer"
className="text-base-content-important"
>
{config.social.medium}
</a>
</div>
</span>
</li>
)
}
{
typeof config.social.devto !== 'undefined' && config.social.devto && (
<li>
<span>
<div>
<FaDev className="mr-2"/>
</div>
<div>
<a
href={`https://dev.to/${config.social.devto}`}
target="_blank"
rel="noreferrer"
className="text-base-content-important"
>
{config.social.devto}
</a>
</div>
</span>
</li>
)
}
{
typeof config.social.website !== 'undefined' && config.social.website && (
<li>
<span>
<div>
<FaGlobe className="mr-2"/>
</div>
<div>
<a
href={`${config.social.website}`}
target="_blank"
rel="noreferrer"
className="text-base-content-important"
>
{config.social.website}
</a>
</div>
</span>
</li>
)
}
{
typeof config.social.phone !== 'undefined' && config.social.phone && (
<li>
<span>
<div>
<RiPhoneFill className="mr-2"/>
</div>
<div>
<a
href={`tel:${config.social.phone}`}
rel="noreferrer"
className="text-base-content-important"
>
{config.social.phone}
</a>
</div>
</span>
</li>
)
}
{
typeof config.social.email !== 'undefined' && config.social.email && (
<li>
<span>
<div>
<MdMail className="mr-2"/>
</div>
<div>
<a
href={`mailto:${config.social.email}`}
target="_blank"
rel="noreferrer"
className="text-base-content-important"
>
{config.social.email}
</a>
</div>
</span>
</li>
)
}
</>
)
}
</ul>
</div>
</div>
)
}
Details.propTypes = {
profile: PropTypes.object
}
export default Details;

View File

@ -1,91 +0,0 @@
import config from "../config";
import { GoPrimitiveDot } from 'react-icons/go';
import { skeleton } from "../helpers/utils";
import { useContext } from "react";
import { LoadingContext } from "../contexts/LoadingContext";
const Education = () => {
const [loading] = useContext(LoadingContext);
const renderSkeleton = () => {
let array = [];
for (let index = 0; index < 2; index++) {
array.push((
<li key={index}>
<span>
{skeleton({ width: 'w-2', height: 'h-2', className: "mr-2" })}
<div className="w-full">
<div className="block justify-between">
<div>
{skeleton({ width: 'w-9/12', height: 'h-4', className: "mb-2" })}
</div>
<div>
{skeleton({ width: 'w-6/12', height: 'h-4', className: "mb-2" })}
</div>
</div>
<div>
{skeleton({ width: 'w-6/12', height: 'h-3' })}
</div>
</div>
</span>
</li>
))
}
return array;
}
return (
<>
{
(typeof config.education !== 'undefined' && config.education.length !== 0) && (
<div className="card shadow-lg compact bg-base-100">
<div className="card-body">
<ul className="menu row-span-3 bg-base-100 text-base-content">
<li>
<div className="pb-0-important mx-3">
<h5 className="card-title">
{
loading ? skeleton({width: 'w-32', height: 'h-8'}) : (
<span className="opacity-70">Education</span>
)
}
</h5>
</div>
</li>
{
loading ? renderSkeleton() : (
config.education.map((item, index) => (
<li key={index}>
<span>
<div>
<GoPrimitiveDot className="mr-2 opacity-40"/>
</div>
<div>
<div className="block justify-between">
<div className="font-medium opacity-70">
{item.institution}
</div>
<div className="opacity-50">
{item.from} - {item.to}
</div>
</div>
<div className="opacity-70">
{item.degree}
</div>
</div>
</span>
</li>
))
)
}
</ul>
</div>
</div>
)
}
</>
)
}
export default Education;

View File

@ -1,27 +0,0 @@
import PropTypes from 'prop-types';
const ErrorPage = (props) => {
return (
<div className="min-w-screen min-h-screen bg-base-200 flex items-center p-5 lg:p-20 overflow-hidden relative">
<div className="flex-1 min-h-full min-w-full rounded-3xl bg-base-100 shadow-xl p-10 lg:p-20 text-gray-800 relative md:flex items-center text-center md:text-left">
<div className="w-full">
<div className="mb-10 md:mb-20 mt-10 md:mt-20 text-gray-600 font-light">
<h1 className="font-black uppercase text-3xl lg:text-5xl text-primary mb-10">{props.status}</h1>
<p className="text-lg pb-2 text-base-content">{props.title}</p>
<p className="text-base-content text-opacity-60">{props.subTitle}</p>
</div>
</div>
</div>
<div className="w-64 md:w-96 h-96 md:h-full bg-accent bg-opacity-10 absolute -top-64 md:-top-96 right-20 md:right-32 rounded-full pointer-events-none -rotate-45 transform"></div>
<div className="w-96 h-full bg-secondary bg-opacity-10 absolute -bottom-96 right-64 rounded-full pointer-events-none -rotate-45 transform"></div>
</div>
)
}
ErrorPage.propTypes = {
status: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
subTitle: PropTypes.string.isRequired
}
export default ErrorPage;

View File

@ -1,91 +0,0 @@
import config from "../config";
import { GoPrimitiveDot } from 'react-icons/go';
import { skeleton } from "../helpers/utils";
import { useContext } from "react";
import { LoadingContext } from "../contexts/LoadingContext";
const Experience = () => {
const [loading] = useContext(LoadingContext);
const renderSkeleton = () => {
let array = [];
for (let index = 0; index < 2; index++) {
array.push((
<li key={index}>
<span>
{skeleton({ width: 'w-2', height: 'h-2', className: "mr-2" })}
<div className="w-full">
<div className="block justify-between">
<div>
{skeleton({ width: 'w-9/12', height: 'h-4', className: "mb-2" })}
</div>
<div>
{skeleton({ width: 'w-6/12', height: 'h-4', className: "mb-2" })}
</div>
</div>
<div>
{skeleton({ width: 'w-6/12', height: 'h-3' })}
</div>
</div>
</span>
</li>
))
}
return array;
}
return (
<>
{
(typeof config.experiences !== 'undefined' && config.experiences.length !== 0) && (
<div className="card shadow-lg compact bg-base-100">
<div className="card-body">
<ul className="menu row-span-3 bg-base-100 text-base-content">
<li>
<div className="pb-0-important mx-3">
<h5 className="card-title">
{
loading ? skeleton({width: 'w-32', height: 'h-8'}) : (
<span className="opacity-70">Experience</span>
)
}
</h5>
</div>
</li>
{
loading ? renderSkeleton() : (
config.experiences.map((experience, index) => (
<li key={index}>
<span>
<div>
<GoPrimitiveDot className="mr-2 opacity-40"/>
</div>
<div>
<div className="block justify-between">
<div className="font-medium opacity-70">
{experience.company}
</div>
<div className="opacity-50">
{experience.from} - {experience.to}
</div>
</div>
<div className="opacity-70">
{experience.position}
</div>
</div>
</span>
</li>
))
)
}
</ul>
</div>
</div>
)
}
</>
)
}
export default Experience;

View File

@ -1,30 +0,0 @@
import { useState, Fragment, useEffect } from 'react';
const LazyImage = ({ placeholder, src, alt, ...rest }) => {
const [loading, setLoading] = useState(true);
useEffect(() => {
const imageToLoad = new Image();
imageToLoad.src = src;
imageToLoad.onload = () => {
setLoading(false);
}
}, [src])
return (
<Fragment>
{
loading ? placeholder : (
<img
src={src}
alt={alt}
{...rest}
/>
)
}
</Fragment>
)
}
export default LazyImage;

View File

@ -1,66 +0,0 @@
import React, { Fragment, useContext } from 'react';
import { Helmet } from "react-helmet-async";
import config from '../config';
import { isThemeDarkish } from '../helpers/utils';
import PropTypes from 'prop-types';
import { ThemeContext } from '../contexts/ThemeContext';
const MetaTags = (props) => {
const [theme] = useContext(ThemeContext);
return (
<Fragment>
{
props.profile && (
<Helmet>
{
config.googleAnalytics?.id && (
<script async src={`https://www.googletagmanager.com/gtag/js?id=${config.googleAnalytics.id}`}></script>
)
}
{
config.googleAnalytics?.id && (
<script>
{
`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${config.googleAnalytics.id}');
`
}
</script>
)
}
<title>Portfolio of {props.profile.name}</title>
<meta name="theme-color" content={isThemeDarkish(theme) ? '#000000' : '#ffffff'}/>
<meta name="description" content={props.profile.bio} />
<meta itemprop="name" content={`Portfolio of ${props.profile.name}`} />
<meta itemprop="description" content={props.profile.bio} />
<meta itemprop="image" content={props.profile.avatar} />
<meta property="og:url" content={typeof config.social.website !== 'undefined' ? config.social.website : ''} />
<meta property="og:type" content="website" />
<meta property="og:title" content={`Portfolio of ${props.profile.name}`} />
<meta property="og:description" content={props.profile.bio} />
<meta property="og:image" content={props.profile.avatar} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={`Portfolio of ${props.profile.name}`} />
<meta name="twitter:description" content={props.profile.bio} />
<meta name="twitter:image" content={props.profile.avatar} />
</Helmet>
)
}
</Fragment>
)
}
MetaTags.propTypes = {
profile: PropTypes.object
}
export default MetaTags;

View File

@ -1,162 +0,0 @@
import { Fragment, useContext } from "react";
import { ga, languageColor, skeleton } from "../helpers/utils";
import { AiOutlineStar, AiOutlineFork } from 'react-icons/ai';
import config from "../config";
import PropTypes from 'prop-types';
import { LoadingContext } from "../contexts/LoadingContext";
const Project = (props) => {
const [loading] = useContext(LoadingContext);
const renderSkeleton = () => {
let array = [];
for (let index = 0; index < config.github.limit; index++) {
array.push((
<div className="card shadow-lg compact bg-base-100" key={index}>
<div className="flex justify-between flex-col p-8 h-full w-full">
<div>
<div className="flex items-center">
<span>
<h5 className="card-title text-lg">
{skeleton({ width: 'w-32', height: 'h-8' })}
</h5>
</span>
</div>
<div className="mb-5 mt-1">
{skeleton({ width: 'w-full', height: 'h-4', className: 'mb-2' })}
{skeleton({ width: 'w-full', height: 'h-4' })}
</div>
</div>
<div className="flex justify-between">
<div className="flex flex-grow">
<span className="mr-3 flex items-center">
{skeleton({ width: 'w-12', height: 'h-4' })}
</span>
<span className="flex items-center">
{skeleton({ width: 'w-12', height: 'h-4' })}
</span>
</div>
<div>
<span className="flex items-center">
{skeleton({ width: 'w-12', height: 'h-4' })}
</span>
</div>
</div>
</div>
</div>
))
}
return array;
}
const renderProjects = () => {
return props.repo.map((item, index) => (
<div
className="card shadow-lg compact bg-base-100 cursor-pointer"
key={index}
onClick={() => {
try {
if (config.googleAnalytics?.id) {
ga.event({
action: "Click project",
params: {
project: item.name
}
});
}
} catch (error) {
console.error(error);
}
window.open(item.html_url, '_blank')
}}
>
<div className="flex justify-between flex-col p-8 h-full w-full">
<div>
<div className="flex items-center opacity-60">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" className="inline-block w-5 h-5 mr-2 stroke-current"><path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path></svg>
<span>
<h5 className="card-title text-lg">
{item.name}
</h5>
</span>
</div>
<p className="mb-5 mt-1 text-base-content text-opacity-60 text-sm">
{item.description}
</p>
</div>
<div className="flex justify-between text-sm text-base-content text-opacity-60">
<div className="flex flex-grow">
<span className="mr-3 flex items-center">
<AiOutlineStar className="mr-0.5" />
<span>{item.stargazers_count}</span>
</span>
<span className="flex items-center">
<AiOutlineFork className="mr-0.5" />
<span>{item.forks_count}</span>
</span>
</div>
<div>
<span className="flex items-center">
<div className="w-3 h-3 rounded-full mr-1 opacity-60" style={{ backgroundColor: languageColor(item.language) }} />
<span>{item.language}</span>
</span>
</div>
</div>
</div>
</div>
));
}
return (
<Fragment>
<div className="col-span-1 lg:col-span-2">
<div className="grid grid-cols-2 gap-6">
<div className="col-span-2">
<div className="card compact bg-base-100 shadow-sm">
<div className="card-body">
<ul className="menu row-span-3 bg-base-100 text-base-content">
<li>
<div className="pb-0-important mx-4 flex items-center justify-between">
<h5 className="card-title">
{
loading ? skeleton({ width: 'w-28', height: 'h-8' }) : (
<span className="opacity-70">My Projects</span>
)
}
</h5>
{
loading ? skeleton({ width: 'w-10', height: 'h-5' }) : (
<a
href={`https://github.com/${config.github.username}?tab=repositories`}
target="_blank"
rel="noreferrer"
className="opacity-50"
>
See All
</a>
)
}
</div>
</li>
</ul>
</div>
</div>
</div>
<div className="col-span-2">
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
{(loading || !props.repo) ? renderSkeleton() : renderProjects()}
</div>
</div>
</div>
</div>
</Fragment>
)
}
Project.propTypes = {
repo: PropTypes.array
}
export default Project;

View File

@ -1,58 +0,0 @@
import { useContext } from "react";
import config from "../config";
import { LoadingContext } from "../contexts/LoadingContext";
import { skeleton } from "../helpers/utils";
const Skill = () => {
const [loading] = useContext(LoadingContext);
const renderSkeleton = () => {
let array = [];
for (let index = 0; index < 12; index++) {
array.push((
<div key={index}>
{skeleton({ width: 'w-16', height: 'h-4', className: 'm-1' })}
</div>
))
}
return array;
}
return (
<>
{
(typeof config.skills !== 'undefined' && config.skills.length !== 0) && (
<div className="card shadow-lg compact bg-base-100">
<div className="card-body">
<div className="mx-3">
<h5 className="card-title">
{
loading ? skeleton({width: 'w-32', height: 'h-8'}) : (
<span className="opacity-70">Tech Stack</span>
)
}
</h5>
</div>
<div className="p-3 flow-root">
<div className="-m-1 flex flex-wrap">
{
loading ? renderSkeleton() : (
config.skills.map((skill, index) => (
<div key={index} className="m-1 text-xs inline-flex items-center font-bold leading-sm uppercase px-3 py-1 badge-primary bg-opacity-75 rounded-full">
{skill}
</div>
))
)
}
</div>
</div>
</div>
</div>
)
}
</>
)
}
export default Skill;

View File

@ -1,78 +0,0 @@
import config from '../config';
import { skeleton } from '../helpers/utils';
import { AiOutlineControl } from 'react-icons/ai';
import { useContext } from 'react';
import { ThemeContext } from '../contexts/ThemeContext';
import { LoadingContext } from '../contexts/LoadingContext';
const ThemeChanger = () => {
const [theme, setTheme] = useContext(ThemeContext);
const [loading] = useContext(LoadingContext);
const changeTheme = (e, selectedTheme) => {
e.preventDefault();
document.querySelector('html').setAttribute('data-theme', selectedTheme);
localStorage.setItem('ezprofile-theme', selectedTheme);
setTheme(selectedTheme);
}
return (
<div className="card overflow-visible shadow-lg compact bg-base-100">
<div className="flex-row items-center space-x-4 flex pl-6 pr-2 py-4">
<div className="flex-1">
<h5 className="card-title">
{
loading ? skeleton({ width: 'w-20', height: 'h-8' }) : (
<span className="opacity-70">Theme</span>
)
}
</h5>
<span className="text-base-content text-opacity-40 capitalize text-sm">
{
loading ? skeleton({ width: 'w-16', height: 'h-5' }) : (theme === config.themeConfig.default ? 'Default' : theme)
}
</span>
</div>
<div className="flex-0">
{
loading ? skeleton({ width: 'w-14 md:w-28', height: 'h-10', className: 'mr-6' }) : (
<div title="Change Theme" className="dropdown dropdown-end">
<div tabIndex={0} className="btn btn-ghost m-1 normal-case opacity-50">
<AiOutlineControl className="inline-block w-5 h-5 stroke-current md:mr-2"/>
<span className="hidden md:inline">
Change Theme
</span>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1792 1792" className="inline-block w-4 h-4 ml-1 fill-current">
<path d="M1395 736q0 13-10 23l-466 466q-10 10-23 10t-23-10l-466-466q-10-10-10-23t10-23l50-50q10-10 23-10t23 10l393 393 393-393q10-10 23-10t23 10l50 50q10 10 10 23z" />
</svg>
</div>
<div tabIndex={0} className="mt-16 overflow-y-auto shadow-2xl top-px dropdown-content h-96 w-52 rounded-b-box bg-base-200 text-base-content">
<ul className="p-4 menu compact">
{
[config.themeConfig.default, ...config.themeConfig.themes.filter(item => item !== config.themeConfig.default)].map((item, index) => (
<li key={index}>
{/* eslint-disable-next-line */}
<a
onClick={(e) => changeTheme(e, item)}
className={`${theme === item ? 'active' : ''}`}
>
<span className="opacity-60 capitalize">
{item === config.themeConfig.default ? 'Default' : item}
</span>
</a>
</li>
))
}
</ul>
</div>
</div>
)
}
</div>
</div>
</div>
)
}
export default ThemeChanger;

View File

@ -0,0 +1,59 @@
import PropTypes from 'prop-types';
import { skeleton } from '../../helpers/utils';
import LazyImage from '../lazy-image';
const AvatarCard = ({ profile, loading }) => {
return (
<div className="card shadow-lg compact bg-base-100">
<div className="grid place-items-center py-8">
{loading || !profile ? (
<div className="avatar opacity-90">
<div className="mb-8 rounded-full w-32 h-32">
{skeleton({
width: 'w-full',
height: 'h-full',
shape: '',
})}
</div>
</div>
) : (
<div className="avatar opacity-90">
<div className="mb-8 rounded-full w-32 h-32 ring ring-primary ring-offset-base-100 ring-offset-2">
{
<LazyImage
src={profile.avatar ? profile.avatar : fallbackImage}
alt={profile.name}
placeholder={skeleton({
width: 'w-full',
height: 'h-full',
shape: '',
})}
/>
}
</div>
</div>
)}
<div className="text-center mx-auto px-8">
<h5 className="font-bold text-2xl">
{loading || !profile ? (
skeleton({ width: 'w-48', height: 'h-8' })
) : (
<span className="opacity-70">{profile.name}</span>
)}
</h5>
<div className="mt-3 text-base-content text-opacity-60 font-mono">
{loading || !profile
? skeleton({ width: 'w-48', height: 'h-5' })
: profile.bio}
</div>
</div>
</div>
</div>
);
};
AvatarCard.propTypes = {
profile: PropTypes.object,
};
export default AvatarCard;

View File

@ -0,0 +1,204 @@
import { getDevtoArticle, getMediumArticle } from 'article-api';
import moment from 'moment';
import { Fragment, useEffect, useState } from 'react';
import { CgHashtag } from 'react-icons/cg';
import config from '../../ezprofile.config';
import { ga, skeleton } from '../../helpers/utils';
import LazyImage from '../lazy-image';
const displaySection = () => {
if (
typeof config.blog !== 'undefined' &&
typeof config.blog.source !== 'undefined' &&
typeof config.blog.username !== 'undefined' &&
config.blog.source &&
config.blog.username
) {
return true;
} else {
return false;
}
};
const Blog = ({ loading }) => {
const [articles, setArticles] = useState(null);
useEffect(() => {
if (displaySection()) {
if (config.blog.source === 'medium') {
getMediumArticle({
user: config.blog.username,
}).then((res) => {
setArticles(res);
});
} else if (config.blog.source === 'dev.to') {
getDevtoArticle({
user: config.blog.username,
}).then((res) => {
setArticles(res);
});
}
}
}, []);
const renderSkeleton = () => {
let array = [];
for (let index = 0; index < config.blog.limit; index++) {
array.push(
<div className="card shadow-lg compact bg-base-100" key={index}>
<div className="p-8 h-full w-full">
<div className="flex items-center flex-col md:flex-row">
<div className="avatar mb-5 md:mb-0">
<div className="w-24 h-24 mask mask-squircle">
{skeleton({
width: 'w-full',
height: 'h-full',
shape: '',
})}
</div>
</div>
<div className="w-full">
<div className="flex items-start px-4">
<div className="w-full">
<h2>
{skeleton({
width: 'w-full',
height: 'h-8',
className: 'mb-2 mx-auto md:mx-0',
})}
</h2>
{skeleton({
width: 'w-24',
height: 'h-3',
className: 'mx-auto md:mx-0',
})}
<div className="mt-3">
{skeleton({
width: 'w-full',
height: 'h-4',
className: 'mx-auto md:mx-0',
})}
</div>
<div className="mt-4 flex items-center flex-wrap justify-center md:justify-start">
{skeleton({
width: 'w-32',
height: 'h-4',
className: 'md:mr-2 mx-auto md:mx-0',
})}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
}
return array;
};
const renderArticles = () => {
return (
articles &&
articles.slice(0, config.blog.limit).map((article, index) => (
<div
className="card shadow-lg compact bg-base-100 cursor-pointer"
key={index}
onClick={() => {
try {
if (config.googleAnalytics?.id) {
ga.event({
action: 'Click Blog Post',
params: {
post: article.title,
},
});
}
} catch (error) {
console.error(error);
}
window.open(article.link, '_blank');
}}
>
<div className="p-8 h-full w-full">
<div className="flex items-center flex-col md:flex-row">
<div className="avatar mb-5 md:mb-0 opacity-90">
<div className="w-24 h-24 mask mask-squircle">
<LazyImage
src={article.thumbnail}
alt={'thumbnail'}
placeholder={skeleton({
width: 'w-full',
height: 'h-full',
shape: '',
})}
/>
</div>
</div>
<div className="w-full">
<div className="flex items-start px-4">
<div className="text-center md:text-left w-full">
<h2 className="font-semibold text-base-content opacity-60">
{article.title}
</h2>
<p className="opacity-50 text-xs">
{moment(article.publishedAt).fromNow()}
</p>
<p className="mt-3 text-base-content text-opacity-60 text-sm">
{article.description}
</p>
<div className="mt-4 flex items-center flex-wrap justify-center md:justify-start">
{article.categories.map((category, index2) => (
<div
className="py-2 px-4 text-xs leading-3 rounded-full bg-base-300 mr-1 mb-1 opacity-50"
key={index2}
>
#{category}
</div>
))}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
))
);
};
return (
<Fragment>
{displaySection() && (
<div className="col-span-1 lg:col-span-2">
<div className="grid grid-cols-2 gap-6">
<div className="col-span-2">
<div className="card compact bg-base-100 shadow-sm">
<div className="card-body">
<div className="mx-3n">
<h5 className="card-title">
{loading ? (
skeleton({ width: 'w-28', height: 'h-8' })
) : (
<span className="opacity-70">Recent Posts</span>
)}
</h5>
</div>
</div>
</div>
</div>
<div className="col-span-2">
<div className="grid grid-cols-1 gap-6">
{loading || !articles ? renderSkeleton() : renderArticles()}
</div>
</div>
</div>
</div>
)}
</Fragment>
);
};
export default Blog;

View File

@ -0,0 +1,192 @@
import { MdLocationOn, MdMail } from 'react-icons/md';
import { AiFillGithub, AiFillMediumSquare } from 'react-icons/ai';
import { SiTwitter } from 'react-icons/si';
import { GrLinkedinOption } from 'react-icons/gr';
import { CgDribbble } from 'react-icons/cg';
import { RiPhoneFill } from 'react-icons/ri';
import { Fragment } from 'react';
import {
FaBehanceSquare,
FaBuilding,
FaDev,
FaFacebook,
FaGlobe,
} from 'react-icons/fa';
import PropTypes from 'prop-types';
import { skeleton } from '../../helpers/utils';
import config from '../../ezprofile.config';
const ListItem = ({ icon, title, value, link, skeleton = false }) => {
return (
<div className="flex justify-start py-2 px-1 items-center">
<span className="w-2 m-2">{icon}</span>
<div className="flex-grow font-medium px-2">{title}</div>
<div
className={`${
skeleton ? 'flex-grow' : ''
} text-sm font-normal text-right mr-2 ml-3 ${link ? 'truncate' : ''}`}
>
<a
href={link}
target="_blank"
rel="noreferrer"
style={{
wordBreak: 'break-word',
}}
>
{value}
</a>
</div>
</div>
);
};
const Details = ({ profile, loading }) => {
const renderSkeleton = () => {
let array = [];
for (let index = 0; index < 4; index++) {
array.push(
<ListItem
key={index}
skeleton={true}
icon={skeleton({ width: 'w-4', height: 'h-4' })}
title={skeleton({ width: 'w-24', height: 'h-4' })}
value={skeleton({ width: 'w-full', height: 'h-4' })}
/>
);
}
return array;
};
return (
<div className="card shadow-lg compact bg-base-100">
<div className="card-body">
<div className="text-base-content text-opacity-60">
{loading || !profile ? (
renderSkeleton()
) : (
<Fragment>
{profile.location && (
<ListItem
icon={<MdLocationOn className="mr-2" />}
title="Based on:"
value={profile.location}
/>
)}
{profile.company && (
<ListItem
icon={<FaBuilding className="mr-2" />}
title="Company:"
value={profile.company}
/>
)}
<ListItem
icon={<AiFillGithub className="mr-2" />}
title="GitHub:"
value={config.github.username}
link={`https://github.com/${config.github.username}`}
/>
{typeof config.social.twitter !== 'undefined' &&
config.social.twitter && (
<ListItem
icon={<SiTwitter className="mr-2" />}
title="Twitter:"
value={config.social.twitter}
link={`https://twitter.com/${config.social.twitter}`}
/>
)}
{typeof config.social.linkedin !== 'undefined' &&
config.social.linkedin && (
<ListItem
icon={<GrLinkedinOption className="mr-2" />}
title="LinkedIn:"
value={config.social.linkedin}
link={`https://www.linkedin.com/in/${config.social.linkedin}`}
/>
)}
{typeof config.social.dribbble !== 'undefined' &&
config.social.dribbble && (
<ListItem
icon={<CgDribbble className="mr-2" />}
title="Dribbble:"
value={config.social.dribbble}
link={`https://dribbble.com/${config.social.dribbble}`}
/>
)}
{typeof config.social.behance !== 'undefined' &&
config.social.behance && (
<ListItem
icon={<FaBehanceSquare className="mr-2" />}
title="Behance:"
value={config.social.behance}
link={`https://www.behance.net/${config.social.behance}`}
/>
)}
{typeof config.social.facebook !== 'undefined' &&
config.social.facebook && (
<ListItem
icon={<FaFacebook className="mr-2" />}
title="Facebook:"
value={config.social.facebook}
link={`https://www.facebook.com/${config.social.facebook}`}
/>
)}
{typeof config.social.medium !== 'undefined' &&
config.social.medium && (
<ListItem
icon={<AiFillMediumSquare className="mr-2" />}
title="Medium:"
value={config.social.medium}
link={`https://medium.com/@${config.social.medium}`}
/>
)}
{typeof config.social.devto !== 'undefined' &&
config.social.devto && (
<ListItem
icon={<FaDev className="mr-2" />}
title="Dev:"
value={config.social.devto}
link={`https://dev.to/${config.social.devto}`}
/>
)}
{typeof config.social.website !== 'undefined' &&
config.social.website && (
<ListItem
icon={<FaGlobe className="mr-2" />}
title="Website:"
value={config.social.website}
link={config.social.website}
/>
)}
{typeof config.social.phone !== 'undefined' &&
config.social.phone && (
<ListItem
icon={<RiPhoneFill className="mr-2" />}
title="Phone:"
value={config.social.phone}
link={`tel:${config.social.phone}`}
/>
)}
{typeof config.social.email !== 'undefined' &&
config.social.email && (
<ListItem
icon={<MdMail className="mr-2" />}
title="Email:"
value={config.social.email}
link={`mailto:${config.social.email}`}
/>
)}
</Fragment>
)}
</div>
</div>
</div>
);
};
Details.propTypes = {
profile: PropTypes.object,
};
export default Details;

View File

@ -0,0 +1,82 @@
import { GoPrimitiveDot } from 'react-icons/go';
import { skeleton } from '../../helpers/utils';
import config from '../../ezprofile.config';
import { Fragment } from 'react';
const ListItem = ({ time, degree, institution }) => (
<li className="mb-5 ml-4">
<div
className="absolute w-2 h-2 bg-base-300 rounded-full border border-base-300 mt-1.5"
style={{ left: '-4.5px' }}
></div>
<div className="my-0.5 text-xs opacity-80">{time}</div>
<h3 className="font-semibold opacity-90">{degree}</h3>
<div className="mb-4 font-normal opacity-90">{institution}</div>
</li>
);
const Education = ({ loading }) => {
const renderSkeleton = () => {
let array = [];
for (let index = 0; index < 2; index++) {
array.push(
<ListItem
key={index}
time={skeleton({
width: 'w-5/12',
height: 'h-4',
})}
degree={skeleton({
width: 'w-6/12',
height: 'h-4',
className: 'my-1.5',
})}
institution={skeleton({ width: 'w-6/12', height: 'h-3' })}
/>
);
}
return array;
};
return (
<>
{typeof config.education !== 'undefined' &&
config.education.length !== 0 && (
<div className="card shadow-lg compact bg-base-100">
<div className="card-body">
<div className="mx-3">
<h5 className="card-title">
{loading ? (
skeleton({ width: 'w-32', height: 'h-8' })
) : (
<span className="opacity-70">Education</span>
)}
</h5>
</div>
<div className="text-base-content text-opacity-60">
<ol className="relative border-l border-base-300 border-opacity-30 my-2 mx-4">
{loading ? (
renderSkeleton()
) : (
<Fragment>
{config.education.map((item, index) => (
<ListItem
key={index}
time={`${item.from} - ${item.to}`}
degree={item.degree}
institution={item.institution}
/>
))}
</Fragment>
)}
</ol>
</div>
</div>
</div>
)}
</>
);
};
export default Education;

View File

@ -0,0 +1,31 @@
import PropTypes from 'prop-types';
const ErrorPage = (props) => {
return (
<div className="min-w-screen min-h-screen bg-base-200 flex items-center p-5 lg:p-20 overflow-hidden relative">
<div className="flex-1 min-h-full min-w-full rounded-3xl bg-base-100 shadow-xl p-10 lg:p-20 text-gray-800 relative md:flex items-center text-center md:text-left">
<div className="w-full">
<div className="mb-10 md:mb-20 mt-10 md:mt-20 text-gray-600 font-light">
<h1 className="font-black uppercase text-3xl lg:text-5xl text-primary mb-10">
{props.status}
</h1>
<p className="text-lg pb-2 text-base-content">{props.title}</p>
<p className="text-base-content text-opacity-60">
{props.subTitle}
</p>
</div>
</div>
</div>
<div className="w-64 md:w-96 h-96 md:h-full bg-accent bg-opacity-10 absolute -top-64 md:-top-96 right-20 md:right-32 rounded-full pointer-events-none -rotate-45 transform"></div>
<div className="w-96 h-full bg-secondary bg-opacity-10 absolute -bottom-96 right-64 rounded-full pointer-events-none -rotate-45 transform"></div>
</div>
);
};
ErrorPage.propTypes = {
status: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
subTitle: PropTypes.string.isRequired,
};
export default ErrorPage;

View File

@ -0,0 +1,82 @@
import { GoPrimitiveDot } from 'react-icons/go';
import { skeleton } from '../../helpers/utils';
import config from '../../ezprofile.config';
import { Fragment } from 'react';
const ListItem = ({ time, position, company }) => (
<li className="mb-5 ml-4">
<div
className="absolute w-2 h-2 bg-base-300 rounded-full border border-base-300 mt-1.5"
style={{ left: '-4.5px' }}
></div>
<div className="my-0.5 text-xs opacity-80">{time}</div>
<h3 className="font-semibold opacity-90">{position}</h3>
<div className="mb-4 font-normal opacity-90">{company}</div>
</li>
);
const Experience = ({ loading }) => {
const renderSkeleton = () => {
let array = [];
for (let index = 0; index < 2; index++) {
array.push(
<ListItem
key={index}
time={skeleton({
width: 'w-5/12',
height: 'h-4',
})}
position={skeleton({
width: 'w-6/12',
height: 'h-4',
className: 'my-1.5',
})}
company={skeleton({ width: 'w-6/12', height: 'h-3' })}
/>
);
}
return array;
};
return (
<>
{typeof config.experiences !== 'undefined' &&
config.experiences.length !== 0 && (
<div className="card shadow-lg compact bg-base-100">
<div className="card-body">
<div className="mx-3">
<h5 className="card-title">
{loading ? (
skeleton({ width: 'w-32', height: 'h-8' })
) : (
<span className="opacity-70">Experience</span>
)}
</h5>
</div>
<div className="text-base-content text-opacity-60">
<ol className="relative border-l border-base-300 border-opacity-30 my-2 mx-4">
{loading ? (
renderSkeleton()
) : (
<Fragment>
{config.experiences.map((experience, index) => (
<ListItem
key={index}
time={`${experience.from} - ${experience.to}`}
position={experience.position}
company={experience.company}
/>
))}
</Fragment>
)}
</ol>
</div>
</div>
</div>
)}
</>
);
};
export default Experience;

View File

@ -0,0 +1,65 @@
import { Fragment } from 'react';
import { Helmet } from 'react-helmet-async';
import PropTypes from 'prop-types';
import config from '../../ezprofile.config';
import { isThemeDarkish } from '../../helpers/utils';
const HeadTagEditor = ({ profile, theme }) => {
return (
<Fragment>
{profile && (
<Helmet>
{config.googleAnalytics?.id && (
<script
async
src={`https://www.googletagmanager.com/gtag/js?id=${config.googleAnalytics.id}`}
></script>
)}
{config.googleAnalytics?.id && (
<script>
{`window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${config.googleAnalytics.id}');`}
</script>
)}
<title>Portfolio of {profile.name}</title>
<meta
name="theme-color"
content={isThemeDarkish(theme) ? '#000000' : '#ffffff'}
/>
<meta name="description" content={profile.bio} />
<meta itemprop="name" content={`Portfolio of ${profile.name}`} />
<meta itemprop="description" content={profile.bio} />
<meta itemprop="image" content={profile.avatar} />
<meta
property="og:url"
content={
typeof config.social.website !== 'undefined'
? config.social.website
: ''
}
/>
<meta property="og:type" content="website" />
<meta property="og:title" content={`Portfolio of ${profile.name}`} />
<meta property="og:description" content={profile.bio} />
<meta property="og:image" content={profile.avatar} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={`Portfolio of ${profile.name}`} />
<meta name="twitter:description" content={profile.bio} />
<meta name="twitter:image" content={profile.avatar} />
</Helmet>
)}
</Fragment>
);
};
HeadTagEditor.propTypes = {
profile: PropTypes.object,
};
export default HeadTagEditor;

View File

@ -0,0 +1,22 @@
import { useState, Fragment, useEffect } from 'react';
const LazyImage = ({ placeholder, src, alt, ...rest }) => {
const [loading, setLoading] = useState(true);
useEffect(() => {
const imageToLoad = new Image();
imageToLoad.src = src;
imageToLoad.onload = () => {
setLoading(false);
};
}, [src]);
return (
<Fragment>
{loading ? placeholder : <img src={src} alt={alt} {...rest} />}
</Fragment>
);
};
export default LazyImage;

View File

@ -0,0 +1,172 @@
import { Fragment } from 'react';
import { AiOutlineStar, AiOutlineFork } from 'react-icons/ai';
import PropTypes from 'prop-types';
import config from '../../ezprofile.config';
import { ga, languageColor, skeleton } from '../../helpers/utils';
const Project = ({ repo, loading }) => {
const renderSkeleton = () => {
let array = [];
for (let index = 0; index < config.github.limit; index++) {
array.push(
<div className="card shadow-lg compact bg-base-100" key={index}>
<div className="flex justify-between flex-col p-8 h-full w-full">
<div>
<div className="flex items-center">
<span>
<h5 className="card-title text-lg">
{skeleton({ width: 'w-32', height: 'h-8' })}
</h5>
</span>
</div>
<div className="mb-5 mt-1">
{skeleton({
width: 'w-full',
height: 'h-4',
className: 'mb-2',
})}
{skeleton({ width: 'w-full', height: 'h-4' })}
</div>
</div>
<div className="flex justify-between">
<div className="flex flex-grow">
<span className="mr-3 flex items-center">
{skeleton({ width: 'w-12', height: 'h-4' })}
</span>
<span className="flex items-center">
{skeleton({ width: 'w-12', height: 'h-4' })}
</span>
</div>
<div>
<span className="flex items-center">
{skeleton({ width: 'w-12', height: 'h-4' })}
</span>
</div>
</div>
</div>
</div>
);
}
return array;
};
const renderProjects = () => {
return repo.map((item, index) => (
<div
className="card shadow-lg compact bg-base-100 cursor-pointer"
key={index}
onClick={() => {
try {
if (config.googleAnalytics?.id) {
ga.event({
action: 'Click project',
params: {
project: item.name,
},
});
}
} catch (error) {
console.error(error);
}
window.open(item.html_url, '_blank');
}}
>
<div className="flex justify-between flex-col p-8 h-full w-full">
<div>
<div className="flex items-center opacity-60">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
className="inline-block w-5 h-5 mr-2 stroke-current"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"
></path>
</svg>
<span>
<h5 className="card-title text-lg">{item.name}</h5>
</span>
</div>
<p className="mb-5 mt-1 text-base-content text-opacity-60 text-sm">
{item.description}
</p>
</div>
<div className="flex justify-between text-sm text-base-content text-opacity-60">
<div className="flex flex-grow">
<span className="mr-3 flex items-center">
<AiOutlineStar className="mr-0.5" />
<span>{item.stargazers_count}</span>
</span>
<span className="flex items-center">
<AiOutlineFork className="mr-0.5" />
<span>{item.forks_count}</span>
</span>
</div>
<div>
<span className="flex items-center">
<div
className="w-3 h-3 rounded-full mr-1 opacity-60"
style={{ backgroundColor: languageColor(item.language) }}
/>
<span>{item.language}</span>
</span>
</div>
</div>
</div>
</div>
));
};
return (
<Fragment>
<div className="col-span-1 lg:col-span-2">
<div className="grid grid-cols-2 gap-6">
<div className="col-span-2">
<div className="card compact bg-base-100 shadow-sm">
<div className="card-body">
<div className="mx-3 flex items-center justify-between">
<h5 className="card-title">
{loading ? (
skeleton({ width: 'w-28', height: 'h-8' })
) : (
<span className="opacity-70">My Projects</span>
)}
</h5>
{loading ? (
skeleton({ width: 'w-10', height: 'h-5' })
) : (
<a
href={`https://github.com/${config.github.username}?tab=repositories`}
target="_blank"
rel="noreferrer"
className="opacity-50"
>
See All
</a>
)}
</div>
</div>
</div>
</div>
<div className="col-span-2">
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
{loading || !repo ? renderSkeleton() : renderProjects()}
</div>
</div>
</div>
</div>
</Fragment>
);
};
Project.propTypes = {
repo: PropTypes.array,
};
export default Project;

View File

@ -0,0 +1,53 @@
import config from '../../ezprofile.config';
import { skeleton } from '../../helpers/utils';
const Skill = ({ loading }) => {
const renderSkeleton = () => {
let array = [];
for (let index = 0; index < 12; index++) {
array.push(
<div key={index}>
{skeleton({ width: 'w-16', height: 'h-4', className: 'm-1' })}
</div>
);
}
return array;
};
return (
<>
{typeof config.skills !== 'undefined' && config.skills.length !== 0 && (
<div className="card shadow-lg compact bg-base-100">
<div className="card-body">
<div className="mx-3">
<h5 className="card-title">
{loading ? (
skeleton({ width: 'w-32', height: 'h-8' })
) : (
<span className="opacity-70">Tech Stack</span>
)}
</h5>
</div>
<div className="p-3 flow-root">
<div className="-m-1 flex flex-wrap justify-center">
{loading
? renderSkeleton()
: config.skills.map((skill, index) => (
<div
key={index}
className="m-1 text-xs inline-flex items-center font-bold leading-sm uppercase px-3 py-1 badge-primary bg-opacity-90 rounded-full"
>
{skill}
</div>
))}
</div>
</div>
</div>
</div>
)}
</>
);
};
export default Skill;

View File

@ -0,0 +1,91 @@
import { AiOutlineControl } from 'react-icons/ai';
import { skeleton } from '../../helpers/utils';
import config from '../../ezprofile.config';
const ThemeChanger = ({ theme, setTheme, loading }) => {
const changeTheme = (e, selectedTheme) => {
e.preventDefault();
document.querySelector('html').setAttribute('data-theme', selectedTheme);
localStorage.setItem('ezprofile-theme', selectedTheme);
setTheme(selectedTheme);
};
return (
<div className="card overflow-visible shadow-lg compact bg-base-100">
<div className="flex-row items-center space-x-4 flex pl-6 pr-2 py-4">
<div className="flex-1">
<h5 className="card-title">
{loading ? (
skeleton({ width: 'w-20', height: 'h-8', className: 'mb-1' })
) : (
<span className="opacity-70">Theme</span>
)}
</h5>
<span className="text-base-content text-opacity-40 capitalize text-sm">
{loading
? skeleton({ width: 'w-16', height: 'h-5' })
: theme === config.themeConfig.default
? 'Default'
: theme}
</span>
</div>
<div className="flex-0">
{loading ? (
skeleton({
width: 'w-14 md:w-28',
height: 'h-10',
className: 'mr-6',
})
) : (
<div title="Change Theme" className="dropdown dropdown-end">
<div
tabIndex={0}
className="btn btn-ghost m-1 normal-case opacity-50"
>
<AiOutlineControl className="inline-block w-5 h-5 stroke-current md:mr-2" />
<span className="hidden md:inline">Change Theme</span>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 1792 1792"
className="inline-block w-4 h-4 ml-1 fill-current"
>
<path d="M1395 736q0 13-10 23l-466 466q-10 10-23 10t-23-10l-466-466q-10-10-10-23t10-23l50-50q10-10 23-10t23 10l393 393 393-393q10-10 23-10t23 10l50 50q10 10 10 23z" />
</svg>
</div>
<div
tabIndex={0}
className="mt-16 overflow-y-auto shadow-2xl top-px dropdown-content h-96 w-52 rounded-b-box bg-base-200 text-base-content"
>
<ul className="p-4 menu compact">
{[
config.themeConfig.default,
...config.themeConfig.themes.filter(
(item) => item !== config.themeConfig.default
),
].map((item, index) => (
<li key={index}>
{/* eslint-disable-next-line */}
<a
onClick={(e) => changeTheme(e, item)}
className={`${theme === item ? 'active' : ''}`}
>
<span className="opacity-60 capitalize">
{item === config.themeConfig.default
? 'Default'
: item}
</span>
</a>
</li>
))}
</ul>
</div>
</div>
)}
</div>
</div>
</div>
);
};
export default ThemeChanger;

View File

@ -1,128 +0,0 @@
// config.js
module.exports = {
github: {
username: 'arifszn', // Your GitHub org/user name. (Required)
sortBy: 'stars', // stars | updated
limit: 8, // How many projects to display.
exclude: {
forks: false, // Forked projects will not be displayed if set to true.
projects: ['laravel-ecommerce'] // These projects will not be displayed. example: ['my-project1', 'my-project2']
}
},
social: {
linkedin: 'ariful-alam',
twitter: 'arif_szn',
facebook: '',
dribbble: '',
behance: '',
medium: '',
devto: 'arifszn',
website: 'https://arifszn.github.io',
phone: '',
email: 'arifulalamszn@gmail.com'
},
skills: [
'PHP',
'Laravel',
'JavaScript',
'React.js',
'Node.js',
'MySQL',
'Git',
'Docker',
'CSS',
'Antd',
'Tailwind',
'Bootstrap',
],
experiences: [
{
company: 'Monstarlab Bangladesh',
position: 'Backend Engineer II',
from: 'September 2021',
to: 'Present'
},
{
company: 'Orangetoolz',
position: 'Jr. Full Stack Engineer',
from: 'July 2019',
to: 'August 2021'
},
{
company: 'Techvillage',
position: 'Jr. Software Engineer',
from: 'January 2019',
to: ' June 2019'
}
],
education: [
{
institution: 'American International University-Bangladesh',
degree: 'Bachelor of Science',
from: '2015',
to: '2019'
},
{
institution: 'Cantonment College, Jessore',
degree: 'Higher Secondary Certificate (HSC)',
from: '2012',
to: '2014',
},
{
institution: 'Chowgacha Shahadat Pilot High School',
degree: 'Secondary School Certificate (SSC)',
from: '2007',
to: '2012'
}
],
blog: {
// Display blog posts from your medium or dev.to account. (Optional)
source: 'dev.to', // medium | dev.to
username: 'arifszn',
limit: 3 // How many posts to display. Max is 10.
},
googleAnalytics: {
// GA3 tracking id/GA4 tag id UA-XXXXXXXXX-X | G-XXXXXXXXXX
id: 'G-WLLB5E14M6' // Please remove this and use your own tag id or keep it empty
},
hotjar: {
id: '2617601', // Please remove this and use your own id or keep it empty
snippetVersion : 6
},
themeConfig: {
default: 'light',
// Hides the switch in the navbar
// Useful if you want to support a single color mode
disableSwitch: false,
// Should we use the prefers-color-scheme media-query,
// using user system preferences, instead of the hardcoded default
respectPrefersColorScheme: true,
// Available themes. To remove any theme, exclude from here.
themes: [
'light',
'dark',
'cupcake',
'bumblebee',
'emerald',
'corporate',
'synthwave',
'retro',
'cyberpunk',
'valentine',
'halloween',
'garden',
'forest',
'aqua',
'lofi',
'pastel',
'fantasy',
'wireframe',
'black',
'luxury',
'dracula'
]
}
}

View File

@ -1,15 +0,0 @@
import { createContext, useState } from "react";
const initialValue = true;
export const LoadingContext = createContext();
export const LoadingProvider = (props) => {
const [loading, setLoading] = useState(initialValue);
return (
<LoadingContext.Provider value={[loading, setLoading]}>
{props.children}
</LoadingContext.Provider>
);
}

View File

@ -1,16 +0,0 @@
import { createContext, useState } from "react";
import { getInitialTheme } from "../helpers/utils";
const initialValue = getInitialTheme();
export const ThemeContext = createContext();
export const ThemeProvider = (props) => {
const [theme, setTheme] = useState(initialValue);
return (
<ThemeContext.Provider value={[theme, setTheme]}>
{props.children}
</ThemeContext.Provider>
);
}

1434
src/data/colors.json Normal file

File diff suppressed because it is too large Load Diff

131
src/ezprofile.config.js Normal file
View File

@ -0,0 +1,131 @@
// ezprofile.config.js
const config = {
github: {
username: 'arifszn', // Your GitHub org/user name. (Required)
sortBy: 'stars', // stars | updated
limit: 8, // How many projects to display.
exclude: {
forks: false, // Forked projects will not be displayed if set to true.
projects: ['laravel-ecommerce'], // These projects will not be displayed. example: ['my-project1', 'my-project2']
},
},
social: {
linkedin: 'ariful-alam',
twitter: 'arif_szn',
facebook: '',
dribbble: '',
behance: '',
medium: '',
devto: 'arifszn',
website: 'https://arifszn.github.io',
phone: '',
email: 'arifulalamszn@gmail.com',
},
skills: [
'PHP',
'Laravel',
'JavaScript',
'React.js',
'Node.js',
'MySQL',
'Git',
'Docker',
'CSS',
'Antd',
'Tailwind',
'Bootstrap',
],
experiences: [
{
company: 'Monstarlab Bangladesh',
position: 'Backend Engineer II',
from: 'September 2021',
to: 'Present',
},
{
company: 'Orangetoolz',
position: 'Jr. Full Stack Engineer',
from: 'July 2019',
to: 'August 2021',
},
{
company: 'Techvillage',
position: 'Jr. Software Engineer',
from: 'January 2019',
to: ' June 2019',
},
],
education: [
{
institution: 'American International University-Bangladesh',
degree: 'Bachelor of Science',
from: '2015',
to: '2019',
},
{
institution: 'Cantonment College, Jessore',
degree: 'Higher Secondary Certificate (HSC)',
from: '2012',
to: '2014',
},
{
institution: 'Chowgacha Shahadat Pilot High School',
degree: 'Secondary School Certificate (SSC)',
from: '2007',
to: '2012',
},
],
blog: {
// Display blog posts from your medium or dev.to account. (Optional)
source: 'dev.to', // medium | dev.to
username: 'arifszn',
limit: 3, // How many posts to display. Max is 10.
},
googleAnalytics: {
// GA3 tracking id/GA4 tag id UA-XXXXXXXXX-X | G-XXXXXXXXXX
id: 'G-WLLB5E14M6', // Please remove this and use your own tag id or keep it empty
},
hotjar: {
id: '2617601', // Please remove this and use your own id or keep it empty
snippetVersion: 6,
},
themeConfig: {
default: 'corporate',
// Hides the switch in the navbar
// Useful if you want to support a single color mode
disableSwitch: false,
// Should we use the prefers-color-scheme media-query,
// using user system preferences, instead of the hardcoded default
respectPrefersColorScheme: true,
// Available themes. To remove any theme, exclude from here.
themes: [
'light',
'dark',
'cupcake',
'bumblebee',
'emerald',
'corporate',
'synthwave',
'retro',
'cyberpunk',
'valentine',
'halloween',
'garden',
'forest',
'aqua',
'lofi',
'pastel',
'fantasy',
'wireframe',
'black',
'luxury',
'dracula',
],
},
};
export default config;

15
src/favicon.svg Normal file
View File

@ -0,0 +1,15 @@
<svg width="410" height="404" viewBox="0 0 410 404" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M399.641 59.5246L215.643 388.545C211.844 395.338 202.084 395.378 198.228 388.618L10.5817 59.5563C6.38087 52.1896 12.6802 43.2665 21.0281 44.7586L205.223 77.6824C206.398 77.8924 207.601 77.8904 208.776 77.6763L389.119 44.8058C397.439 43.2894 403.768 52.1434 399.641 59.5246Z" fill="url(#paint0_linear)"/>
<path d="M292.965 1.5744L156.801 28.2552C154.563 28.6937 152.906 30.5903 152.771 32.8664L144.395 174.33C144.198 177.662 147.258 180.248 150.51 179.498L188.42 170.749C191.967 169.931 195.172 173.055 194.443 176.622L183.18 231.775C182.422 235.487 185.907 238.661 189.532 237.56L212.947 230.446C216.577 229.344 220.065 232.527 219.297 236.242L201.398 322.875C200.278 328.294 207.486 331.249 210.492 326.603L212.5 323.5L323.454 102.072C325.312 98.3645 322.108 94.137 318.036 94.9228L279.014 102.454C275.347 103.161 272.227 99.746 273.262 96.1583L298.731 7.86689C299.767 4.27314 296.636 0.855181 292.965 1.5744Z" fill="url(#paint1_linear)"/>
<defs>
<linearGradient id="paint0_linear" x1="6.00017" y1="32.9999" x2="235" y2="344" gradientUnits="userSpaceOnUse">
<stop stop-color="#41D1FF"/>
<stop offset="1" stop-color="#BD34FE"/>
</linearGradient>
<linearGradient id="paint1_linear" x1="194.651" y1="8.81818" x2="236.076" y2="292.989" gradientUnits="userSpaceOnUse">
<stop stop-color="#FFEA83"/>
<stop offset="0.0833333" stop-color="#FFDD35"/>
<stop offset="1" stop-color="#FFA800"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

File diff suppressed because it is too large Load Diff

View File

@ -1,79 +0,0 @@
import config from "../config";
import colors from './colors.json';
import { hotjar } from 'react-hotjar';
export const getInitialTheme = () => {
if (config.themeConfig.disableSwitch) {
return config.themeConfig.default;
}
if (localStorage.hasOwnProperty('ezprofile-theme')) {
let theme = localStorage.getItem('ezprofile-theme');
return theme;
}
if (config.themeConfig.respectPrefersColorScheme && !config.themeConfig.disableSwitch) {
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : config.themeConfig.default;
}
return config.themeConfig.default;
}
export const skeleton = ({width = null, height = null, style = {}, shape = 'rounded-full', className = null}) => {
return <div className={`bg-base-300 animate-pulse ${shape}${className ? ` ${className}` : ''}${width ? ` ${width}` : ''}${height ? ` ${height}` : ''}`} style={style}/>;
}
export const languageColor = (language) => {
if (typeof colors[language] !== 'undefined') {
return colors[language].color;
} else {
return 'gray';
}
}
export const fallbackImage = (
"data:image/png;base64,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"
)
export const ga = {
// initialize google analytic
initialize: (id) => {
try {
window.gtag('js', new Date());
window.gtag('config', id);
} catch (error) {
console.error(error);
}
},
// log specific events happening
event: ({ action, params }) => {
try {
window.gtag('event', action, params);
} catch (error) {
console.error(error);
}
}
}
export const isThemeDarkish = (theme) => {
if (
theme === 'dark' ||
theme === 'halloween' ||
theme === 'forest' ||
theme === 'black' ||
theme === 'luxury' ||
theme === 'dracula'
) {
return true;
} else {
return false;
}
}
export const setupHotjar = () => {
if (config.hotjar?.id) {
let snippetVersion = config.hotjar?.snippetVersion ? config.hotjar?.snippetVersion : 6;
hotjar.initialize(config.hotjar.id, snippetVersion);
}
}

98
src/helpers/utils.jsx Normal file
View File

@ -0,0 +1,98 @@
import config from '../ezprofile.config';
import colors from '../data/colors.json';
import { hotjar } from 'react-hotjar';
export const getInitialTheme = () => {
if (config.themeConfig.disableSwitch) {
return config.themeConfig.default;
}
if (!(localStorage.getItem('ezprofile-theme') === null)) {
let theme = localStorage.getItem('ezprofile-theme');
return theme;
}
if (
config.themeConfig.respectPrefersColorScheme &&
!config.themeConfig.disableSwitch
) {
return window.matchMedia('(prefers-color-scheme: dark)').matches
? 'dark'
: config.themeConfig.default;
}
return config.themeConfig.default;
};
export const skeleton = ({
width = null,
height = null,
style = {},
shape = 'rounded-full',
className = null,
}) => {
return (
<div
className={`bg-base-300 animate-pulse ${shape}${
className ? ` ${className}` : ''
}${width ? ` ${width}` : ''}${height ? ` ${height}` : ''}`}
style={style}
/>
);
};
export const languageColor = (language) => {
if (typeof colors[language] !== 'undefined') {
return colors[language].color;
} else {
return 'gray';
}
};
export const fallbackImage =
'data:image/png;base64,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';
export const ga = {
// initialize google analytic
initialize: (id) => {
try {
window.gtag('js', new Date());
window.gtag('config', id);
} catch (error) {
console.error(error);
}
},
// log specific events happening
event: ({ action, params }) => {
try {
window.gtag('event', action, params);
} catch (error) {
console.error(error);
}
},
};
export const isThemeDarkish = (theme) => {
if (
theme === 'dark' ||
theme === 'halloween' ||
theme === 'forest' ||
theme === 'black' ||
theme === 'luxury' ||
theme === 'dracula'
) {
return true;
} else {
return false;
}
};
export const setupHotjar = () => {
if (config.hotjar?.id) {
let snippetVersion = config.hotjar?.snippetVersion
? config.hotjar?.snippetVersion
: 6;
hotjar.initialize(config.hotjar.id, snippetVersion);
}
};

View File

@ -3,85 +3,90 @@
@tailwind utilities;
* {
scrollbar-width: thin;
scrollbar-width: thin;
}
::-webkit-scrollbar-track {
box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
-moz-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
-moz-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
}
@media screen and (min-width: 966px) {
::-webkit-scrollbar, .scroller {
width: 8px;
height: 8px;
background-color: #f1f1f1;
}
::-webkit-scrollbar,
.scroller {
width: 8px;
height: 8px;
background-color: #f1f1f1;
}
}
::-webkit-scrollbar-thumb {
background-color: #888;
border-radius: 10px;
background-color: #888;
border-radius: 10px;
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
.text-base-content-important {
color: hsla(var(--bc) / var(--tw-text-opacity)) !important;
color: hsla(var(--bc) / var(--tw-text-opacity)) !important;
}
svg {
vertical-align: unset
vertical-align: unset;
}
.z-hover {
transition: all ease-in-out 0.3s !important;
transition: all ease-in-out 0.3s !important;
}
.z-hover:hover,
.z-hover:focus,
.z-hover:active {
transition: transform 0.3s !important;
-ms-transform: scale(1.01) !important;
-webkit-transform: scale(1.01) !important;
transform: scale(1.01) !important;
transition: transform 0.3s !important;
-ms-transform: scale(1.01) !important;
-webkit-transform: scale(1.01) !important;
transform: scale(1.01) !important;
}
.pb-0-important {
padding-bottom: 0 !important;
padding-bottom: 0 !important;
}
.fade-in {
opacity: 1;
animation-name: fadeIn;
animation-iteration-count: 1;
animation-timing-function: ease-in;
animation-duration: 1s;
opacity: 1;
animation-name: fadeIn;
animation-iteration-count: 1;
animation-timing-function: ease-in;
animation-duration: 1s;
}
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
opacity: 0;
}
100% {
opacity: 1;
}
}
@-webkit-keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
from {
opacity: 0;
}
to {
opacity: 1;
}
}

View File

@ -1,25 +0,0 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { HelmetProvider } from 'react-helmet-async';
import { ThemeProvider } from './contexts/ThemeContext';
import { LoadingProvider } from './contexts/LoadingContext';
import { setupHotjar } from './helpers/utils';
ReactDOM.render(
<React.StrictMode>
<ThemeProvider>
<LoadingProvider>
<HelmetProvider>
<App/>
</HelmetProvider>
</LoadingProvider>
</ThemeProvider>
</React.StrictMode>,
document.getElementById('root')
);
reportWebVitals();
setupHotjar();

14
src/main.jsx Normal file
View File

@ -0,0 +1,14 @@
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import { HelmetProvider } from 'react-helmet-async';
ReactDOM.render(
<React.StrictMode>
<HelmetProvider>
<App />
</HelmetProvider>
</React.StrictMode>,
document.getElementById('root')
);

View File

@ -1,13 +0,0 @@
const reportWebVitals = onPerfEntry => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);
getFID(onPerfEntry);
getFCP(onPerfEntry);
getLCP(onPerfEntry);
getTTFB(onPerfEntry);
});
}
};
export default reportWebVitals;

View File

@ -1,5 +0,0 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';

View File

@ -1,16 +1,10 @@
module.exports = {
purge: ['./src/**/*.{js,jsx,ts,tsx}', './public/index.html'],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [
require('daisyui')
],
daisyui: {
logs: false
},
}
content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
theme: {
extend: {},
},
plugins: [require('daisyui')],
daisyui: {
logs: false,
},
};

7
vite.config.js Normal file
View File

@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()]
})