mirror of
https://github.com/NohamR/gitprofile.git
synced 2026-05-25 20:00:25 +00:00
Pass object instead of array in context provider
This commit is contained in:
@@ -16,8 +16,8 @@ import Project from './components/project';
|
|||||||
import Blog from './components/blog';
|
import Blog from './components/blog';
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const [theme] = useContext(ThemeContext);
|
const { theme } = useContext(ThemeContext);
|
||||||
const [, setLoading] = useContext(LoadingContext);
|
const { setLoading } = useContext(LoadingContext);
|
||||||
const [profile, setProfile] = useState(null);
|
const [profile, setProfile] = useState(null);
|
||||||
const [repo, setRepo] = useState(null);
|
const [repo, setRepo] = useState(null);
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { skeleton } from '../../helpers/utils';
|
|||||||
import LazyImage from '../lazy-image';
|
import LazyImage from '../lazy-image';
|
||||||
|
|
||||||
const AvatarCard = (props) => {
|
const AvatarCard = (props) => {
|
||||||
const [loading] = useContext(LoadingContext);
|
const { loading } = useContext(LoadingContext);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="card shadow-lg compact bg-base-100">
|
<div className="card shadow-lg compact bg-base-100">
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const displaySection = () => {
|
|||||||
|
|
||||||
const Blog = () => {
|
const Blog = () => {
|
||||||
const [articles, setArticles] = useState(null);
|
const [articles, setArticles] = useState(null);
|
||||||
const [loading] = useContext(LoadingContext);
|
const { loading } = useContext(LoadingContext);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (displaySection()) {
|
if (displaySection()) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
FaGlobe,
|
FaGlobe,
|
||||||
} from 'react-icons/fa';
|
} from 'react-icons/fa';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Fragment, useContext } from 'react';
|
import { useContext } from 'react';
|
||||||
import { LoadingContext } from '../../contexts/LoadingContext';
|
import { LoadingContext } from '../../contexts/LoadingContext';
|
||||||
import { skeleton } from '../../helpers/utils';
|
import { skeleton } from '../../helpers/utils';
|
||||||
import config from '../../ezprofile.config';
|
import config from '../../ezprofile.config';
|
||||||
@@ -32,7 +32,7 @@ const ListItem = ({ icon, title, value, link }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Details = (props) => {
|
const Details = (props) => {
|
||||||
const [loading] = useContext(LoadingContext);
|
const { loading } = useContext(LoadingContext);
|
||||||
|
|
||||||
const renderSkeleton = () => {
|
const renderSkeleton = () => {
|
||||||
let array = [];
|
let array = [];
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { skeleton } from '../../helpers/utils';
|
|||||||
import config from '../../ezprofile.config';
|
import config from '../../ezprofile.config';
|
||||||
|
|
||||||
const Education = () => {
|
const Education = () => {
|
||||||
const [loading] = useContext(LoadingContext);
|
const { loading } = useContext(LoadingContext);
|
||||||
|
|
||||||
const renderSkeleton = () => {
|
const renderSkeleton = () => {
|
||||||
let array = [];
|
let array = [];
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { skeleton } from '../../helpers/utils';
|
|||||||
import config from '../../ezprofile.config';
|
import config from '../../ezprofile.config';
|
||||||
|
|
||||||
const Experience = () => {
|
const Experience = () => {
|
||||||
const [loading] = useContext(LoadingContext);
|
const { loading } = useContext(LoadingContext);
|
||||||
|
|
||||||
const renderSkeleton = () => {
|
const renderSkeleton = () => {
|
||||||
let array = [];
|
let array = [];
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import config from '../../ezprofile.config';
|
|||||||
import { isThemeDarkish } from '../../helpers/utils';
|
import { isThemeDarkish } from '../../helpers/utils';
|
||||||
|
|
||||||
const HeadTagEditor = (props) => {
|
const HeadTagEditor = (props) => {
|
||||||
const [theme] = useContext(ThemeContext);
|
const { theme } = useContext(ThemeContext);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import config from '../../ezprofile.config';
|
|||||||
import { ga, languageColor, skeleton } from '../../helpers/utils';
|
import { ga, languageColor, skeleton } from '../../helpers/utils';
|
||||||
|
|
||||||
const Project = (props) => {
|
const Project = (props) => {
|
||||||
const [loading] = useContext(LoadingContext);
|
const { loading } = useContext(LoadingContext);
|
||||||
|
|
||||||
const renderSkeleton = () => {
|
const renderSkeleton = () => {
|
||||||
let array = [];
|
let array = [];
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import config from '../../ezprofile.config';
|
|||||||
import { skeleton } from '../../helpers/utils';
|
import { skeleton } from '../../helpers/utils';
|
||||||
|
|
||||||
const Skill = () => {
|
const Skill = () => {
|
||||||
const [loading] = useContext(LoadingContext);
|
const { loading } = useContext(LoadingContext);
|
||||||
|
|
||||||
const renderSkeleton = () => {
|
const renderSkeleton = () => {
|
||||||
let array = [];
|
let array = [];
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ import { skeleton } from '../../helpers/utils';
|
|||||||
import config from '../../ezprofile.config';
|
import config from '../../ezprofile.config';
|
||||||
|
|
||||||
const ThemeChanger = () => {
|
const ThemeChanger = () => {
|
||||||
const [theme, setTheme] = useContext(ThemeContext);
|
const { theme, setTheme } = useContext(ThemeContext);
|
||||||
const [loading] = useContext(LoadingContext);
|
const { loading } = useContext(LoadingContext);
|
||||||
|
|
||||||
|
console.log(theme);
|
||||||
|
|
||||||
const changeTheme = (e, selectedTheme) => {
|
const changeTheme = (e, selectedTheme) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
Reference in New Issue
Block a user