|
35 | 35 |
|
36 | 36 | <EditForm Model="@model" OnValidSubmit="OnValidBlogPostCreatedAsync">
|
37 | 37 | <DataAnnotationsValidator />
|
38 |
| - |
| 38 | + |
39 | 39 | <div class="row g-4">
|
40 | 40 | <div class="col-lg-8">
|
41 | 41 | <div class="card shadow-sm border-0 hover-shadow-lg transition">
|
|
45 | 45 | <div class="card-body p-0">
|
46 | 46 | <div class="p-4 border-bottom">
|
47 | 47 | <div class="form-floating">
|
48 |
| - <input type="text" class="form-control form-control-lg border-0 shadow-none" |
| 48 | + <input type="text" class="form-control form-control-lg border-0 shadow-none fs-3 fw-semibold" |
49 | 49 | id="title" placeholder="Enter your post title..."
|
50 |
| - @oninput="args => model.Title = args.Value!.ToString()!" |
51 |
| - value="@model.Title" |
52 |
| - style="font-size: 1.5rem; font-weight: 600;" /> |
| 50 | + @oninput="args => model.Title = args.Value!.ToString()!" |
| 51 | + value="@model.Title"/> |
53 | 52 | <label for="title" class="fw-bold">Post Title</label>
|
54 | 53 | </div>
|
55 | 54 | <ValidationMessage For="() => model.Title" class="text-danger small mt-1"></ValidationMessage>
|
56 | 55 | </div>
|
57 | 56 |
|
58 | 57 | <div class="p-4 border-bottom">
|
59 | 58 | <label class="form-label fw-bold text-dark mb-3">Short Description</label>
|
60 |
| - <MarkdownTextArea Id="short" Class="form-control border-0 shadow-none" |
| 59 | + <MarkdownTextArea Id="short" Class="form-control border-0 shadow-none" |
61 | 60 | Rows="4" Placeholder="Write a compelling summary..."
|
62 | 61 | @bind-Value="@model.ShortDescription"
|
63 | 62 | PreviewFunction="ReplaceShortCodes"></MarkdownTextArea>
|
|
69 | 68 | Content <span class="badge bg-secondary ms-2 fw-medium">@ReadingTimeCalculator.GetWordCount(model.Content) words</span>
|
70 | 69 | <span class="badge bg-info ms-1 fw-medium">~@GetEstimatedReadTime() min read</span>
|
71 | 70 | </label>
|
72 |
| - <MarkdownTextArea Id="content" Class="form-control border-0 shadow-none" |
| 71 | + <MarkdownTextArea Id="content" Class="form-control border-0 shadow-none" |
73 | 72 | Rows="25" Placeholder="Start writing your amazing content..."
|
74 | 73 | PreviewFunction="ReplaceShortCodes"
|
75 | 74 | @bind-Value="@model.Content"></MarkdownTextArea>
|
76 | 75 | <ValidationMessage For="() => model.Content" class="text-danger small mt-1"></ValidationMessage>
|
77 | 76 |
|
78 | 77 | <div class="position-absolute top-0 end-0 m-3">
|
79 | 78 | <div class="btn-group">
|
80 |
| - <button class="btn btn-outline-primary btn-sm dropdown-toggle" type="button" |
| 79 | + <button class="btn btn-outline-primary btn-sm dropdown-toggle" type="button" |
81 | 80 | data-bs-toggle="dropdown" aria-expanded="false">
|
82 | 81 | Tools
|
83 | 82 | </button>
|
|
129 | 128 | </div>
|
130 | 129 | <div class="card-body">
|
131 | 130 | <div class="form-floating">
|
132 |
| - <InputText type="text" class="form-control" id="tags" |
133 |
| - placeholder="technology, programming, tutorial" |
| 131 | + <InputText type="text" class="form-control" id="tags" |
| 132 | + placeholder="technology, programming, tutorial" |
134 | 133 | @bind-Value="model.Tags" />
|
135 | 134 | <label for="tags">Tags (comma separated)</label>
|
136 | 135 | </div>
|
|
181 | 180 | }
|
182 | 181 | <ValidationMessage For="() => model.ScheduledPublishDate" class="text-danger small mt-1"></ValidationMessage>
|
183 | 182 | </div>
|
184 |
| - |
| 183 | + |
185 | 184 | @if (BlogPost is not null && !IsScheduled)
|
186 | 185 | {
|
187 | 186 | <div class="form-check form-switch">
|
|
202 | 201 | <div class="card-body">
|
203 | 202 | <div class="mb-3">
|
204 | 203 | <div class="form-floating">
|
205 |
| - <InputText type="url" class="form-control" id="preview" |
206 |
| - placeholder="https://example.com/image.jpg" |
| 204 | + <InputText type="url" class="form-control" id="preview" |
| 205 | + placeholder="https://example.com/image.jpg" |
207 | 206 | @bind-Value="model.PreviewImageUrl" />
|
208 | 207 | <label for="preview">Primary Image URL</label>
|
209 | 208 | </div>
|
210 | 209 | <ValidationMessage For="() => model.PreviewImageUrl" class="text-danger small mt-1"></ValidationMessage>
|
211 | 210 | </div>
|
212 | 211 | <div class="mb-3">
|
213 | 212 | <div class="form-floating">
|
214 |
| - <InputText type="url" class="form-control" id="fallback-preview" |
215 |
| - placeholder="https://example.com/fallback.jpg" |
| 213 | + <InputText type="url" class="form-control" id="fallback-preview" |
| 214 | + placeholder="https://example.com/fallback.jpg" |
216 | 215 | @bind-Value="model.PreviewImageUrlFallback" />
|
217 | 216 | <label for="fallback-preview">Fallback Image URL</label>
|
218 | 217 | </div>
|
|
306 | 305 | {
|
307 | 306 | return "Editing";
|
308 | 307 | }
|
309 |
| - |
| 308 | + |
310 | 309 | if (model.IsPublished)
|
311 | 310 | {
|
312 | 311 | return "Ready to Publish";
|
313 | 312 | }
|
314 |
| - |
| 313 | + |
315 | 314 | if (IsScheduled)
|
316 | 315 | {
|
317 | 316 | return "Scheduled";
|
318 | 317 | }
|
319 |
| - |
| 318 | + |
320 | 319 | return "Draft";
|
321 | 320 | }
|
322 | 321 |
|
323 | 322 | private int GetEstimatedReadTime()
|
324 | 323 | {
|
325 | 324 | if (string.IsNullOrWhiteSpace(model.Content))
|
326 | 325 | return 1;
|
327 |
| - |
| 326 | + |
328 | 327 | return ReadingTimeCalculator.CalculateReadingTime(model.Content);
|
329 | 328 | }
|
330 | 329 |
|
|
0 commit comments