mirror of
https://github.com/tymur999/braintok.git
synced 2025-08-05 16:20:37 +00:00
Dynamic notes
This commit is contained in:

committed by
Mark Goltsman

parent
9242466754
commit
f815f6ca60
11
src/app/data/notes.tsx
Normal file
11
src/app/data/notes.tsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// src/data/notes.ts
|
||||||
|
|
||||||
|
export const notes: string[] = [
|
||||||
|
"The average attention span is 8.25 s",
|
||||||
|
"E = mc^2",
|
||||||
|
"We are a team of dreamers!",
|
||||||
|
"Our names are Kaz, Tymur, Daniil, and Mark!",
|
||||||
|
"LET'S GO TECH",
|
||||||
|
"In my free time, I do poster design for my dorm room",
|
||||||
|
'Ass breaker'
|
||||||
|
];
|
@@ -1,58 +1,89 @@
|
|||||||
import React from 'react';
|
"use client"
|
||||||
import './App.css'; // Make sure to add styles here
|
|
||||||
|
import React from 'react';
|
||||||
|
import {notes as initialNotes} from '../data/notes'
|
||||||
|
// @ts-ignore
|
||||||
|
import { useState } from "react";
|
||||||
|
// Example of notes array
|
||||||
|
|
||||||
// Example of notes array (similar to the content in the image)
|
|
||||||
const notes = [
|
|
||||||
"The average attention span is 8.25 s",
|
|
||||||
"E = mc^2",
|
|
||||||
"We are a team of dreamers!",
|
|
||||||
"Our names are Kaz, Tymur, Daniil, and Mark!",
|
|
||||||
"LET'S GO TECH",
|
|
||||||
"In my free time, I do poster design for my dorm room"
|
|
||||||
];
|
|
||||||
|
|
||||||
// Utility function to generate random sizes and positions
|
// Utility function to generate random sizes and positions
|
||||||
const getRandomStyles = () => {
|
const getRandomStyles = () => {
|
||||||
const randomWidth = Math.floor(Math.random() * (200 - 100 + 1)) + 100; // Width between 100 and 200px
|
const randomX = Math.floor(Math.random() * 20); // Left margin
|
||||||
const randomHeight = Math.floor(Math.random() * (150 - 80 + 1)) + 80; // Height between 80 and 150px
|
const randomY = Math.floor(Math.random() * 10); // Top margin
|
||||||
const randomX = Math.floor(Math.random() * 40); // Left margin (to simulate shifting)
|
|
||||||
const randomY = Math.floor(Math.random() * 20); // Top margin (for shifting vertically)
|
|
||||||
const randomBackground = getRandomColor(); // Assign a random background color
|
const randomBackground = getRandomColor(); // Assign a random background color
|
||||||
|
|
||||||
return {
|
return {
|
||||||
width: `${randomWidth}px`,
|
padding: `${Math.random() * 20 + 10}px`, // Random padding between 10px and 30px
|
||||||
height: `${randomHeight}px`,
|
|
||||||
marginLeft: `${randomX}px`,
|
marginLeft: `${randomX}px`,
|
||||||
marginTop: `${randomY}px`,
|
marginTop: `${randomY}px`,
|
||||||
backgroundColor: randomBackground,
|
backgroundColor: randomBackground,
|
||||||
borderRadius: '20px',
|
borderRadius: '10px',
|
||||||
display: 'flex',
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
fontSize: '1.1rem',
|
fontSize: '1.1rem',
|
||||||
padding: '10px',
|
textAlign: 'center',
|
||||||
color: '#fff', // White text color
|
flexGrow: 1, // Allow notes to grow and fill the container
|
||||||
fontWeight: 'bold'
|
color: '#000', // Black text color
|
||||||
|
fontWeight: 'bold',
|
||||||
|
minWidth: '100px', // Ensure a minimum width for each note
|
||||||
|
boxSizing: 'border-box' // Ensure padding is included in the width calculation
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper function to generate a random color from a predefined list
|
// Helper function to generate a random color from a predefined list
|
||||||
const getRandomColor = () => {
|
const getRandomColor = () => {
|
||||||
const colors = ['#F7DC6F', '#E74C3C', '#48C9B0', '#85C1E9', '#F1948A', '#5DADE2'];
|
const colors = ['#FFDE59', '#FF5757', '#5CE1E6'];
|
||||||
return colors[Math.floor(Math.random() * colors.length)];
|
return colors[Math.floor(Math.random() * colors.length)];
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Landing() {
|
export default function Landing() {
|
||||||
|
const [notes, setNotes] = useState<string[]>(initialNotes); // Set the initial state
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mindmap-container">
|
<div style={containerStyles}>
|
||||||
<h1>Your personal mind space</h1>
|
<div style={innerContainerStyles}>
|
||||||
<div className="notes-container">
|
<h1 style={headerStyles}>Your personal mind space</h1>
|
||||||
{notes.map((note, index) => (
|
<div style={notesContainerStyles}>
|
||||||
<div key={index} style={getRandomStyles()}>
|
{notes.map((note, index) => (
|
||||||
{note}
|
<div key={index} style={getRandomStyles()}>
|
||||||
</div>
|
{note}
|
||||||
))}
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Additional styles for responsiveness
|
||||||
|
const containerStyles = {
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
height: "100vh", // Ensure the container spans vertically
|
||||||
|
padding: "10px",
|
||||||
|
width: "600px"
|
||||||
|
};
|
||||||
|
|
||||||
|
const innerContainerStyles = {
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
width: "100%", // Span the container horizontally
|
||||||
|
};
|
||||||
|
|
||||||
|
const notesContainerStyles = {
|
||||||
|
display: 'flex',
|
||||||
|
flexWrap: 'wrap',
|
||||||
|
justifyContent: 'flex-start', // Align notes to the left
|
||||||
|
gap: '10px', // Add some gap between the notes
|
||||||
|
width: '100%', // Make notes container take the full width
|
||||||
|
margin: 'auto',
|
||||||
|
};
|
||||||
|
|
||||||
|
const headerStyles = {
|
||||||
|
fontSize: '2.5rem',
|
||||||
|
textAlign: 'center',
|
||||||
|
marginBottom: '50px',
|
||||||
|
fontWeight: 'bold'
|
||||||
|
};
|
Reference in New Issue
Block a user