Skip to content

Commit 9ddcd8e

Browse files
committed
🎨 UI improve new library and Fixed some errors.
- swapy implemlented - Languages card reworked
1 parent 3dd15a2 commit 9ddcd8e

File tree

7 files changed

+71
-28
lines changed

7 files changed

+71
-28
lines changed

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"react": "^18.3.1",
2323
"react-dom": "^18.3.1",
2424
"react-icons": "^5.3.0",
25+
"swapy": "^0.4.2",
2526
"tailwindcss": "^3.4.14"
2627
},
2728
"devDependencies": {

‎pnpm-lock.yaml‎

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/assets/css/tailwind.css‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/components/ContentApp/ContentApp.jsx‎

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,48 @@
11
import { motion } from 'framer-motion'
2+
import { createSwapy } from 'swapy'
3+
import { useEffect } from 'react'
24
import { ContactCard, ProfileCard, ReposCard, Languages } from '../../components'
35

46
export default function ContentApp() {
7+
useEffect(() => {
8+
const container = document.querySelector('.container')
9+
const swapy = createSwapy(container, { swapMode: 'dynamic' })
10+
11+
swapy.onSwap(({ data }) => {
12+
console.log('Nuevo orden:', data.object)
13+
})
14+
swapy.enable(true)
15+
16+
return () => {
17+
swapy.destroy()
18+
}
19+
}, [])
20+
521
return (
6-
<div>
22+
<div className="container">
723
<div className="grid grid-cols-1 gap-0 lg:grid-cols-3 lg:gap-6 rounded-box">
8-
<motion.div
9-
initial={{ opacity: 0, x: -50 }}
10-
animate={{ opacity: 1, x: 0 }}
11-
transition={{ duration: 0.5 }}
12-
>
13-
<ProfileCard />
14-
<ContactCard />
15-
<Languages />
16-
</motion.div>
17-
<motion.div
18-
className="col-span-2 gap-4 p-4 mb-4 rounded-lg bg-zinc-800"
19-
initial={{ opacity: 0, x: 50 }}
20-
animate={{ opacity: 1, x: 0 }}
21-
transition={{ duration: 0.5 }}
22-
>
23-
<ReposCard />
24-
</motion.div>
24+
<div className="lg:col-span-1">
25+
<div data-swapy-slot="1">
26+
<div data-swapy-item="profile">
27+
<ProfileCard />
28+
</div>
29+
</div>
30+
<div data-swapy-slot="2">
31+
<div data-swapy-item="contact">
32+
<ContactCard />
33+
</div>
34+
</div>
35+
<div data-swapy-slot="3">
36+
<div data-swapy-item="languages">
37+
<Languages />
38+
</div>
39+
</div>
40+
</div>
41+
<div className="col-span-3 gap-4 p-4 mb-4 rounded-lg bg-zinc-800 lg:col-span-2">
42+
<div>
43+
<ReposCard />
44+
</div>
45+
</div>
2546
</div>
2647
</div>
2748
)

‎src/components/Languages/Languages.jsx‎

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useGithubUser } from '../../context/GitHubUserContext'
2-
import { Card, CardBody, CardHeader, Progress } from '@nextui-org/react'
2+
import { Card, CardBody, CardHeader, Chip } from '@nextui-org/react'
33
import languageColors from '../../data/colors.json'
44

55
const Languages = () => {
@@ -17,16 +17,29 @@ const Languages = () => {
1717
<Card is isHoverable className="mb-4">
1818
<CardHeader>
1919
<h4 className="leading-none font-open-sans text-small text-default-600">
20-
Languages used in my repositories:{count.size}
20+
Languages I've learned:{count.size}
2121
</h4>
2222
</CardHeader>
2323
<CardBody>
24-
<div>
25-
{languageStats.map(({ language, percentage, count }) => {
24+
<div className="flex flex-wrap gap-2 mt-2">
25+
{languageStats.map(({ language }) => {
2626
const languageColor = getLanguageColor(language)
2727
return (
28-
<div key={language} style={{ marginBottom: '1px' }}>
29-
<Progress
28+
<div key={language} className="flex-shrink-0">
29+
<Chip
30+
color="primary"
31+
variant="faded"
32+
startContent={
33+
<p
34+
className="w-3 h-3 mr-1 rounded-full opacity-60"
35+
style={{ backgroundColor: languageColor }}
36+
/>
37+
}
38+
>
39+
{language}
40+
</Chip>
41+
42+
{/* <Progress
3043
label={
3144
<div className="flex items-center">
3245
<div
@@ -42,7 +55,7 @@ const Languages = () => {
4255
value={parseFloat(percentage)}
4356
color="primary"
4457
showValueLabel={true}
45-
/>
58+
/> */}
4659
</div>
4760
)
4861
})}

‎src/components/ReposCard/ReposCard.jsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default function ReposCard() {
7878
if (!Array.isArray(userRepos)) return <p>No repositories found</p>
7979

8080
return (
81-
<ScrollShadow hideScrollBar className="h-[calc(85vh-32px)] overflow-auto ">
81+
<ScrollShadow hideScrollBar className="h-[calc(65vh-0px)] overflow-auto ">
8282
<div className="grid grid-cols-2 gap-4 p-2 mb-4 overflow-auto">
8383
{filteredRepos.slice(0, itemToShow).map((repo, index) => {
8484
const isLastElement = index === itemToShow - 1

‎src/main.jsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import ReactDOM from 'react-dom/client'
22
import { NextUIProvider } from '@nextui-org/react'
3-
import Index from './pages/index'
3+
import Index from './pages/Index'
44
import './assets/css/tailwind.css'
55

66
ReactDOM.createRoot(document.getElementById('root')).render(

0 commit comments

Comments
 (0)