Files
portfolio/docs/sprint-artifacts/2-5-create-download-button-component.md
T
mahdiarghyani 56676771ca feat(resume): complete Epic 2 - Resume Preview Page
Epic 2: Resume Preview Page - All 5 stories completed

Story 2-1: Create Resume Page Route
- Add /resume standalone page with layout: false
- Implement print mode detection (?print=true)
- Add SEO meta tags (noindex for privacy)
- Set page title "Resume - Ali Arghyani"

Story 2-2: Create ResumePreview Container
- Add single-column A4 container (210mm × 297mm)
- Implement white background with 24px margins
- Add print styles with .no-print class
- Configure responsive layout

Story 2-3: Create Header, Summary, Experience Components
- Add ResumeHeader with profile photo, name, contact info
- Add ResumeSummary with blue uppercase section header
- Add ResumeExperience with sorted jobs and date formatting
- Add image property to ResumeBasics interface
- Integrate all components into ResumePreview

Story 2-4: Create Education & Additional Info Components
- Add ResumeEducation with date formatting
- Add ResumeAdditionalInfo with skills, languages, certifications
- Integrate components into ResumePreview

Story 2-5: Create Download Button Component
- Add ResumeDownloadButton FAB (fixed bottom-right)
- Add download icon and "Download PDF" text
- Implement print mode detection
- Add placeholder click handler for Epic 3 integration
- Responsive: text on desktop, icon-only on mobile

Additional:
- Add profile image to resume data (/img/AliProfile.webp)
- Update sprint-status.yaml: all Epic 2 stories marked done

Files Created:
- app/pages/resume.vue
- app/components/resume/ResumePreview.vue
- app/components/resume/ResumeHeader.vue
- app/components/resume/ResumeSummary.vue
- app/components/resume/ResumeExperience.vue
- app/components/resume/ResumeEducation.vue
- app/components/resume/ResumeAdditionalInfo.vue
- app/components/resume/ResumeDownloadButton.vue

Files Modified:
- app/types/resume.ts (added image property)
- app/data/resume.en.ts (added profile image)
- docs/sprint-artifacts/sprint-status.yaml (updated story statuses)
- docs/sprint-artifacts/2-1-create-resume-page-route.md (completed)
- docs/sprint-artifacts/2-2-create-resume-preview-container-component.md (completed)
- docs/sprint-artifacts/2-3-create-resume-header-main-content-components.md (completed)
- docs/sprint-artifacts/2-4-create-resume-sidebar-components.md (completed)
- docs/sprint-artifacts/2-5-create-download-button-component.md (completed)

Closes Epic 2
Closes Story 2-1, 2-2, 2-3, 2-4, 2-5
2025-12-01 11:46:46 +03:30

234 lines
6.8 KiB
Markdown

# Story 2.5: Create Download Button Component
Status: done
## Story
As a user,
I want a prominent download button,
so that I can easily download my resume as PDF.
## Acceptance Criteria
1. **AC1:** Given I'm on the resume page, when I see the download button, then it's a floating action button (FAB) in bottom-right corner
2. **AC2:** It has download icon (i-heroicons-arrow-down-tray)
3. **AC3:** It has "Download PDF" text (or just icon on mobile)
4. **AC4:** It has blue background color
5. **AC5:** It has fixed position (doesn't scroll)
6. **AC6:** It has shadow for elevation
7. **AC7:** It has the `.no-print` class (hidden in PDF)
8. **AC8:** Given I'm on the page with `?print=true`, when the page renders, then the button is not visible
## Tasks / Subtasks
- [x] Create ResumeDownloadButton component (AC: #1-#7)
- [x] Create `app/components/resume/ResumeDownloadButton.vue`
- [x] Use Nuxt UI `UButton` component
- [x] Set icon to `i-heroicons-arrow-down-tray`
- [x] Add "Download PDF" text
- [x] Apply blue background: `color="primary"` or `bg-blue-600`
- [x] Set fixed position: `fixed bottom-6 right-6`
- [x] Add shadow: `shadow-lg`
- [x] Add `.no-print` class
- [x] Implement print mode detection (AC: #8)
- [x] Accept prop: `isPrintMode` (boolean)
- [x] Use `v-if="!isPrintMode"` to conditionally render
- [x] Ensure button hidden when `?print=true`
- [x] Add placeholder click handler
- [x] Add `@click` event handler
- [x] For now, log to console: "Download PDF clicked"
- [x] Note: Actual PDF generation will be implemented in Epic 3
- [x] Integrate into resume page (AC: #1-#8)
- [x] Import component in `pages/resume.vue`
- [x] Pass `isPrintMode` prop from route query
- [x] Place button outside ResumePreview container
- [x] Verify button appears in bottom-right corner
- [x] Test button functionality
- [x] Verify button appears in bottom-right corner
- [x] Check fixed position (doesn't scroll with page)
- [x] Verify blue background and shadow
- [x] Test icon displays correctly
- [x] Check "Download PDF" text visibility
- [x] Test click handler (console log)
- [x] Verify button hidden with `?print=true`
- [x] Test print preview (Ctrl+P) - button should be hidden
## Dev Notes
### Architecture Alignment
**From Architecture Doc:**
- File location: `app/components/resume/ResumeDownloadButton.vue`
- Component: Use Nuxt UI `UButton` component
- Icon: Heroicons arrow-down-tray
- Position: Fixed bottom-right (FAB pattern)
**From Tech Spec Epic 2:**
- AC12 maps to this story
- Button hidden in print mode for PDF generation
- Placeholder for Epic 3 integration
### Learnings from Previous Story
**From Story 2.4 (Status: drafted)**
- Sidebar components created (Contact, Skills, Education, Languages)
- All resume sections now complete
- ResumePreview fully populated with content
- **Integration Point**: Add download button to resume page, outside ResumePreview container
**From Story 2.1 (Status: drafted)**
- Print mode detection implemented via `useRoute().query.print`
- `isPrintMode` computed property available in `pages/resume.vue`
- **Integration Point**: Pass `isPrintMode` to download button component
[Source: docs/sprint-artifacts/2-4-create-resume-sidebar-components.md]
[Source: docs/sprint-artifacts/2-1-create-resume-page-route.md]
### Project Structure Notes
**File to Create:**
- `app/components/resume/ResumeDownloadButton.vue`
**Files to Modify:**
- `app/pages/resume.vue` - Import and place download button
**Dependencies:**
- `@nuxt/ui` - `UButton` component
- Heroicons icon set (via Nuxt UI)
**Future Integration:**
- Epic 3 Story 3.2 will create `useResumePdf()` composable
- Epic 3 Story 3.3 will connect this button to PDF generation
### Implementation Notes
**ResumeDownloadButton.vue:**
```vue
<script setup lang="ts">
interface Props {
isPrintMode?: boolean
}
defineProps<Props>()
const handleDownload = () => {
// Placeholder - will be replaced in Epic 3 Story 3.3
console.log('Download PDF clicked')
// Future: const { downloadPdf } = useResumePdf()
// Future: await downloadPdf()
}
</script>
<template>
<UButton
v-if="!isPrintMode"
icon="i-heroicons-arrow-down-tray"
size="lg"
color="primary"
class="fixed bottom-6 right-6 shadow-lg no-print z-50"
@click="handleDownload"
>
<span class="hidden sm:inline">Download PDF</span>
</UButton>
</template>
<style scoped>
@media print {
.no-print {
display: none !important;
}
}
</style>
```
**Integration in pages/resume.vue:**
```vue
<script setup lang="ts">
definePageMeta({
layout: false
})
const route = useRoute()
const isPrintMode = computed(() => route.query.print === 'true')
useHead({
title: 'Resume - Ali Arghyani',
meta: [
{ name: 'robots', content: 'noindex' }
]
})
</script>
<template>
<div class="min-h-screen bg-white">
<ResumePreview />
<ResumeDownloadButton :is-print-mode="isPrintMode" />
</div>
</template>
```
**Responsive Behavior:**
- Desktop: Shows "Download PDF" text with icon
- Mobile: Shows icon only (text hidden with `hidden sm:inline`)
**Z-Index:**
- Set `z-50` to ensure button appears above all content
**Testing Checklist:**
- [ ] Button appears in bottom-right corner
- [ ] Button has fixed position (stays in place when scrolling)
- [ ] Blue background color applied
- [ ] Shadow visible for elevation
- [ ] Download icon displays correctly
- [ ] "Download PDF" text visible on desktop
- [ ] Text hidden on mobile (< 640px)
- [ ] Click handler logs to console
- [ ] Button hidden with `?print=true` parameter
- [ ] Button hidden in print preview (Ctrl+P)
- [ ] Button has proper z-index (appears above content)
### References
- [Source: docs/architecture.md#Implementation-Patterns]
- [Source: docs/architecture.md#Novel-Pattern-WYSIWYG-PDF-Export]
- [Source: docs/sprint-artifacts/tech-spec-epic-2.md#AC12-Download-Button]
- [Source: docs/sprint-artifacts/tech-spec-epic-2.md#AC13-Print-Mode]
- [Source: docs/epics.md#Story-2.5-Create-Download-Button-Component]
## Dev Agent Record
### Context Reference
- docs/sprint-artifacts/2-5-create-download-button-component.context.xml
### Agent Model Used
<!-- Will be filled by dev agent -->
### Debug Log References
<!-- Will be filled by dev agent during implementation -->
### Completion Notes List
- Created `ResumeDownloadButton.vue` with UButton, fixed position FAB
- Implemented print mode detection via `isPrintMode` prop
- Added placeholder click handler (console.log for Epic 3 integration)
- Integrated into `pages/resume.vue` with proper prop passing
- Responsive: shows text on desktop, icon-only on mobile
### File List
- app/components/resume/ResumeDownloadButton.vue (created)
- app/pages/resume.vue (modified)
---
**Change Log:**
- 2025-11-30: Story drafted by SM agent (mahdi)
- 2025-12-01: Implemented by Dev agent (Amelia) - All ACs completed, status: done