Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bootstrap themes from anna repo #112

Merged
merged 3 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/anna/theme.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

var (
baseURL = "https://github.com/anna-ssg/themes/releases/download"
tagVer = "v2.0"
tagVer = "v3.0"
destDir = "site"
)

Expand Down
9 changes: 8 additions & 1 deletion cmd/anna/wizard.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (ws *WizardServer) handleSubmit(w http.ResponseWriter, r *http.Request) {
ws.ErrorLogger.Println("Method not allowed")
return
}

// got the form data, now ask theme.go to unzip and place in current dir
var config parser.LayoutConfig
err := json.NewDecoder(r.Body).Decode(&config)

Expand All @@ -67,6 +67,13 @@ func (ws *WizardServer) handleSubmit(w http.ResponseWriter, r *http.Request) {
ws.ErrorLogger.Println(err)
return
}
// Call DownloadTheme function from theme.go
err = DownloadTheme(config.ThemeURL)
if err != nil {
http.Error(w, "Internal server error", http.StatusInternalServerError)
ws.ErrorLogger.Println("Error downloading and extracting theme:", err)
return
}
FormSubmittedCh <- struct{}{}
}

Expand Down
67 changes: 34 additions & 33 deletions site/static/wizard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,31 @@ <h1 class="navbar-title">Setup Wizard 🍚</h1>
<div id="wizard" class="slide">
<div class="content">
<h2>Get started!</h2>
<div class="input-group"><input type="text" id="author" required placeholder="Enter an author name"
oninput="checkFormValidity()"></div>
<div class="nav-buttons"><button onclick="nextSlide()" id="authorButton" disabled>Next</button>
<div class="input-group">
<input type="text" id="author" required placeholder="Enter an author name"
oninput="checkFormValidity()">
</div>
<div class="nav-buttons">
<button onclick="nextSlide()" id="authorButton" disabled>Next</button>
</div>
</div>
<div class="content">
<h2>Name your site</h2>
<div class="input-group"><input type="text" id="siteTitle" required placeholder="ex: my blog"
oninput="checkFormValidity()"></div>
<div class="input-group">
<input type="text" id="siteTitle" required placeholder="ex: my blog"
oninput="checkFormValidity()">
</div>
<div class="nav-buttons">
<button onclick="prevSlide()">&larr;</button>
<button onclick="nextSlide()" id="siteTitleButton" disabled>Next &rarr;</button>
</div>
</div>
<div class="content">
<h2>Enter a domain name</h2>
<div class="input-group"><input type="text" id="baseURL" required
placeholder="ex: https://anna.github.io" oninput="checkFormValidity()"></div>
<div class="input-group">
<input type="text" id="baseURL" required placeholder="ex: https://anna.github.io"
oninput="checkFormValidity()">
</div>
<div class="nav-buttons">
<button onclick="prevSlide()">&larr;</button>
<button onclick="nextSlide()" id="baseURLButton" disabled>Next &rarr;</button>
Expand All @@ -48,44 +55,38 @@ <h2>Enter a domain name</h2>
<div class="content">
<h2>Pick what you'd like on the navbar</h2>
<div class="nav-checkboxes">
<label><input type="checkbox" id="navbar-index" checked class="Home" value="index.html">Home</label><br>
<label><input type="checkbox" id="navbar-index" checked class="Home"
value="index.html">Home</label><br>
<label><input type="checkbox" id="navbar-tags" class="Tags" value="tags.html">Tags</label><br>
<label><input type="checkbox" id="navbar-tags" class="Collections" value="collections.html">Collections</label><br>
<label><input type="checkbox" id="navbar-collections" class="Collections"
value="collections.html">Collections</label><br>
</div>
<div class="nav-buttons">
<button onclick="prevSlide()">&larr;</button>
<button onclick="nextSlide()" id="navbarButton">Next &rarr;</button>
</div>
<button onclick="prevSlide()">&larr;</button>
<button onclick="nextSlide()" id="baseURLButton">Next &rarr;</button>
</div>
</div>
<div class="content">
<h2>Choose a Theme</h2>
<div class="input-group">
<select id="themeURL" required oninput="checkFormValidity()">
<option value="/static/style.css" selected>default</option>
<option value="/static/styles/sudhir.css">Sudhir</option>
<option value="/static/styles/hegde.css">Hegde</option>
<option value="/static/styles/nathan.css">Nathan</option>
<option value="/static/styles/new.css">new CSS</option>
<option value="/static/styles/pico.css">Pico CSS</option>
<option value="/static/styles/simple.css">Simple CSS</option>
</select>
<div class="content">
<h2>Choose a Theme</h2>
<div class="input-group">
<select id="themeURL" required oninput="checkFormValidity()">
</select>
</div>
<div class="nav-buttons">
<button onclick="prevSlide()">&larr;</button>
<button onclick="submitForm()">Submit</button>
</div>
</div>
<div class="nav-buttons">
<button onclick="prevSlide()">&larr;</button>
<button onclick="submitForm()">Submit</button>
<div class="content" id="final-slide">
<h2>Cooking your Anna site</h2>
<p>Your Anna site is being cooked. This page will reload...</p>
</div>
</div>
<div class="content" id="final-slide">
<h2>Cooking your Anna site</h2>
<p>Your Anna site is being cooked. This page will reload...</p>
</div>
</div>
</div>
</article>
<script defer async src="https://cdn.jsdelivr.net/npm/[email protected]/tsparticles.bundle.min.js"></script>
<script defer src="script.js"></script>
<footer></footer>
</body>

</html>
</html>
Loading