|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | +<meta charset="UTF-8"> |
| 5 | +<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | +<title>JavaBooks Documentation</title> |
| 7 | +<style> |
| 8 | +/* ===== CSS ===== */ |
| 9 | +body, html { margin:0; padding:0; font-family: Arial,sans-serif; scroll-behavior:smooth; } |
| 10 | +.container { display:flex; min-height:100vh; } |
| 11 | +.sidebar { width:220px; background:#1e90ff; color:white; padding:20px; position:fixed; height:100%; overflow-y:auto; } |
| 12 | +.sidebar h2 { text-align:center; margin-bottom:30px; } |
| 13 | +.sidebar ul { list-style:none; padding:0; } |
| 14 | +.sidebar ul li { margin:15px 0; } |
| 15 | +.sidebar ul li a { color:white; text-decoration:none; font-weight:bold; transition:color 0.3s ease; } |
| 16 | +.sidebar ul li a:hover, .sidebar ul li a.active { color:#ffeb3b; } |
| 17 | +.content { margin-left:240px; padding:30px; flex:1; animation:fadeIn 0.5s ease; } |
| 18 | +.screenshot { max-width:300px; margin:10px 0; border:1px solid #ccc; transition:transform 0.3s ease; } |
| 19 | +.screenshot:hover { transform:scale(1.05); } |
| 20 | +pre { background:#eaeaea; padding:10px; overflow-x:auto; } |
| 21 | +h1,h2,h3 { color:#1e90ff; } |
| 22 | +section { margin-bottom:50px; } |
| 23 | +@keyframes fadeIn { from{opacity:0; transform:translateY(20px);} to{opacity:1; transform:translateY(0);} } |
| 24 | +</style> |
| 25 | +</head> |
| 26 | +<body> |
| 27 | +<div class="container"> |
| 28 | + <!-- Sidebar --> |
| 29 | + <aside class="sidebar"> |
| 30 | + <h2>JavaBooks</h2> |
| 31 | + <ul> |
| 32 | + <li><a href="#overview" class="active">Overview</a></li> |
| 33 | + <li><a href="#installation">Installation</a></li> |
| 34 | + <li><a href="#usage">Usage</a></li> |
| 35 | + <li><a href="#classes">Classes</a></li> |
| 36 | + <li><a href="#docker">Docker</a></li> |
| 37 | + <li><a href="#ci">CI/CD</a></li> |
| 38 | + <li><a href="#license">License</a></li> |
| 39 | + </ul> |
| 40 | + </aside> |
| 41 | + |
| 42 | + <!-- Content --> |
| 43 | + <main class="content"> |
| 44 | + <section id="overview"> |
| 45 | + <h1>Overview</h1> |
| 46 | + <p>JavaBooks is a Java library for managing books in console apps, web apps, and games like Minecraft. Provides add/list/search functions and easy integration into projects.</p> |
| 47 | + <!-- Example Screenshots (base64 placeholders) --> |
| 48 | + <img class="screenshot" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA..." alt="Console Screenshot"> |
| 49 | + <img class="screenshot" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA..." alt="Web Screenshot"> |
| 50 | + </section> |
| 51 | + |
| 52 | + <section id="installation"> |
| 53 | + <h1>Installation</h1> |
| 54 | + <p>Clone the repository:</p> |
| 55 | + <pre><code>git clone https://github.com/yourusername/JavaBooks.git</code></pre> |
| 56 | + <p>Include in Maven or Gradle project:</p> |
| 57 | + <pre><code><dependency> |
| 58 | + <groupId>com.javabooks</groupId> |
| 59 | + <artifactId>javabooks</artifactId> |
| 60 | + <version>1.0.0</version> |
| 61 | +</dependency></code></pre> |
| 62 | + </section> |
| 63 | + |
| 64 | + <section id="usage"> |
| 65 | + <h1>Usage Examples</h1> |
| 66 | + <h2>Console Example</h2> |
| 67 | + <pre><code>Library library = new Library(); |
| 68 | +library.addBook(new Book("Java Programming","John Doe",2022)); |
| 69 | +library.listBooks(); |
| 70 | +library.searchByAuthor("Jane Smith");</code></pre> |
| 71 | + <h2>Web Example</h2> |
| 72 | + <pre><code>@RestController |
| 73 | +@RequestMapping("/books") |
| 74 | +public class ExampleWeb { |
| 75 | + private Library library = new Library(); |
| 76 | + @GetMapping public List<Book> getAllBooks() { return library.getBooks(); } |
| 77 | +}</code></pre> |
| 78 | + </section> |
| 79 | + |
| 80 | + <section id="classes"> |
| 81 | + <h1>Classes</h1> |
| 82 | + <h2>Book</h2> |
| 83 | + <pre><code>public class Book { |
| 84 | + private String title; |
| 85 | + private String author; |
| 86 | + private int year; |
| 87 | + public Book(String title,String author,int year){...} |
| 88 | + public String getTitle(){...} |
| 89 | + public String getAuthor(){...} |
| 90 | + public int getYear(){...} |
| 91 | + public String toString(){...} |
| 92 | +}</code></pre> |
| 93 | + <h2>Library</h2> |
| 94 | + <pre><code>public class Library { |
| 95 | + public void addBook(Book book){...} |
| 96 | + public void listBooks(){...} |
| 97 | + public void searchByAuthor(String author){...} |
| 98 | + public void searchByTitle(String title){...} |
| 99 | + public List<Book> getBooks(){...} |
| 100 | +}</code></pre> |
| 101 | + </section> |
| 102 | + |
| 103 | + <section id="docker"> |
| 104 | + <h1>Docker</h1> |
| 105 | + <pre><code>docker build -t javabooks . |
| 106 | +docker run -it javabooks</code></pre> |
| 107 | + </section> |
| 108 | + |
| 109 | + <section id="ci"> |
| 110 | + <h1>CI/CD</h1> |
| 111 | + <pre><code>name: Java CI |
| 112 | +on: [push, pull_request] |
| 113 | +jobs: |
| 114 | + build: |
| 115 | + runs-on: ubuntu-latest |
| 116 | + steps: |
| 117 | + - uses: actions/checkout@v3 |
| 118 | + - uses: actions/setup-java@v3 |
| 119 | + with: java-version:17 |
| 120 | + - run: mvn clean compile</code></pre> |
| 121 | + </section> |
| 122 | + |
| 123 | + <section id="license"> |
| 124 | + <h1>License</h1> |
| 125 | + <p>MIT License. See LICENSE file for details.</p> |
| 126 | + </section> |
| 127 | + </main> |
| 128 | +</div> |
| 129 | + |
| 130 | +<script> |
| 131 | +// ===== JS ===== |
| 132 | +// Highlight active sidebar link on scroll |
| 133 | +const links=document.querySelectorAll('.sidebar ul li a'); |
| 134 | +const sections=document.querySelectorAll('main section'); |
| 135 | +function activateLink(){ |
| 136 | + let scrollPos=window.scrollY+120; |
| 137 | + sections.forEach(section=>{ |
| 138 | + if(scrollPos>=section.offsetTop && scrollPos<section.offsetTop+section.offsetHeight){ |
| 139 | + links.forEach(link=>link.classList.remove('active')); |
| 140 | + document.querySelector('.sidebar ul li a[href="#'+section.id+'"]').classList.add('active'); |
| 141 | + } |
| 142 | + }); |
| 143 | +} |
| 144 | +window.addEventListener('scroll', activateLink); |
| 145 | +</script> |
| 146 | +</body> |
| 147 | +</html> |
0 commit comments