Skip to content

Commit

Permalink
fix: spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexGherardelli committed Sep 21, 2024
1 parent 9c9daea commit 11cb4c9
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 66 deletions.
7 changes: 6 additions & 1 deletion app/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,19 @@ body {

/* Prompt box styles */
.prompt-box {
margin-bottom: 20px;
margin: 50px;
font-size: 1.2em;
padding: 20px;
border: 2px solid #ccc;
border-radius: 5px;
background-color: #fafafa;
}


header {
margin: 50px;
}

/* Button styling */
button {
background-color: #ff9800;
Expand Down
24 changes: 14 additions & 10 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,26 @@
</head>

<body>
<section class="section">
<div class="container is-flex is-flex-direction-column is-justify-content-center is-align-items-center"
style="min-height: 100vh;">
<header class="has-text-centered">
<div class="section is-fullheight">
<div class="container is-flex is-flex-direction-column is-justify-content-space-between is-align-items-center"
style="height: 100vh;">


<main class="is-flex-grow-1 is-flex is-flex-direction-column is-justify-content-center">
<header class="has-text-centered">
<h1 class="title">SketchShuffle</h1>
<p class="subtitle">Sharpen your skills by reviewing essential art fundamentals daily!</p>
</header>

<main class="mt-5">
<div id="prompt-box" class="box has-text-centered mb-4">
<p>Click the button to shuffle an art fundamental to study today!</p>
</header>

<div id="prompt-box" class="has-text-centered mb-4">
<p class="title is-4">You will study <strong>{Fundamental}</strong></p>
<p class="subtitle is-6">Focusing on <strong>{SubGroup}</strong></p>
<p class="content">Exercise: <strong>{Topic}</strong></p>
</div>
<button class="button is-primary is-fullwidth" id="shuffle-btn">Shuffle Fundamental</button>
</main>
</div>
</section>
</div>

<footer class="footer has-background-light">
<div class="content has-text-centered">
Expand Down
80 changes: 25 additions & 55 deletions app/js/app.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,29 @@
// Object of art fundamentals, subgroups, and specific topics
const fundamentals = {
"Gesture Drawing": [
{ subgroup: "Dynamic Poses", topics: [] },
{ subgroup: "Action Lines", topics: [] }
],
"Perspective": [
{ subgroup: "One-Point Perspective", topics: [] },
{ subgroup: "Two-Point Perspective", topics: [] },
{ subgroup: "Three-Point Perspective", topics: [] }
],
"Anatomy": [
{ subgroup: "Face", topics: ["Azaro Head", "Features: Mouth", "Features: Eyes"] },
{ subgroup: "Body", topics: ["Hands", "Torso"] }
],
"Color Theory": [
{ subgroup: "Primary Colors", topics: [] },
{ subgroup: "Color Harmonies", topics: [] }
],
"Composition": [
{ subgroup: "Rule of Thirds", topics: [] },
{ subgroup: "Leading Lines", topics: [] }
]
};
// Sample data
const fundamentals = [
{ fundamental: "Anatomy", subgroup: "Face", topic: "Azaro Head" },
{ fundamental: "Color Theory", subgroup: "Primary Colors", topic: "Mixing Red and Yellow" },
{ fundamental: "Perspective", subgroup: "One-Point", topic: "Drawing a Road" },
// Add more objects as needed
];

// Get references to DOM elements
const shuffleButton = document.getElementById('shuffle-btn');
const promptBox = document.getElementById('prompt-box');

// Function to generate a random fundamental and subgroup
function shuffleFundamental() {
// Get a random main category (fundamental)
const fundamentalsKeys = Object.keys(fundamentals);
const randomFundamentalIndex = Math.floor(Math.random() * fundamentalsKeys.length);
const selectedFundamental = fundamentalsKeys[randomFundamentalIndex];

// Get a random subgroup from the selected fundamental
const subgroups = fundamentals[selectedFundamental];
const randomSubgroupIndex = Math.floor(Math.random() * subgroups.length);
const selectedSubgroup = subgroups[randomSubgroupIndex];

// Check if there are topics in the subgroup, and pick one if available
let topic = "";
if (selectedSubgroup.topics.length > 0) {
const randomTopicIndex = Math.floor(Math.random() * selectedSubgroup.topics.length);
topic = selectedSubgroup.topics[randomTopicIndex];
}

// Display the result
let resultText = `Today's focus: <strong>${selectedFundamental}</strong> -> <strong>${selectedSubgroup.subgroup}</strong>`;
if (topic) {
resultText += ` -> <strong>${topic}</strong>`;
}
// Function to shuffle and get a random fundamental
function getRandomFundamental() {
const randomIndex = Math.floor(Math.random() * fundamentals.length);
return fundamentals[randomIndex];
}

promptBox.innerHTML = `<p>${resultText}</p>`;
// Function to update the prompt box
function updatePromptBox() {
const { fundamental, subgroup, topic } = getRandomFundamental();

// Update the prompt box content
document.querySelector('#prompt-box .title').innerHTML = `You will study <strong>${fundamental}</strong>`;
document.querySelector('#prompt-box .subtitle').innerHTML = `Focusing on <strong>${subgroup}</strong>`;
document.querySelector('#prompt-box .content').innerHTML = `Exercise: <strong>${topic}</strong>`;
}

// Attach event listener to the button
shuffleButton.addEventListener('click', shuffleFundamental);
// Event listener for the shuffle button
document.getElementById('shuffle-btn').addEventListener('click', updatePromptBox);

// Generate the first set on page load
window.onload = updatePromptBox;

0 comments on commit 11cb4c9

Please sign in to comment.