-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor the new translation ui components into reusable NoorUI compo…
…nents (#629)
- Loading branch information
1 parent
bcc4d69
commit c83a53a
Showing
13 changed files
with
379 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// | ||
// QuranArabicText.swift | ||
// | ||
// | ||
// Created by Mohamed Afifi on 2024-02-10. | ||
// | ||
|
||
import Localization | ||
import QuranKit | ||
import QuranText | ||
import SwiftUI | ||
|
||
public struct QuranArabicText: View { | ||
@ScaledMetric var bottomPadding = 5 | ||
@ScaledMetric var topPadding = 10 | ||
|
||
let verse: AyahNumber | ||
let text: String | ||
let fontSize: FontSize | ||
|
||
public init(verse: AyahNumber, text: String, fontSize: FontSize) { | ||
self.verse = verse | ||
self.text = text | ||
self.fontSize = fontSize | ||
} | ||
|
||
public var body: some View { | ||
VStack(alignment: .leading, spacing: 0) { | ||
Text(lFormat("translation.text.ayah-number", verse.sura.suraNumber, verse.ayah)) | ||
.padding(8) | ||
.foregroundColor(.secondaryLabel) | ||
.background( | ||
RoundedRectangle(cornerRadius: 6) | ||
.fill(Color.systemGray5.opacity(0.5)) | ||
) | ||
|
||
Text(text) | ||
.font(.quran()) | ||
.dynamicTypeSize(fontSize.dynamicTypeSize) | ||
.textAlignment(follows: .rightToLeft) | ||
} | ||
.padding(.bottom, bottomPadding) | ||
.padding(.top, topPadding) | ||
.readableInsetsPadding(.horizontal) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// QuranPageFooter.swift | ||
// | ||
// | ||
// Created by Mohamed Afifi on 2024-02-10. | ||
// | ||
|
||
import SwiftUI | ||
|
||
public struct QuranPageFooter: View { | ||
let page: String | ||
|
||
public init(page: String) { | ||
self.page = page | ||
} | ||
|
||
public var body: some View { | ||
HStack { | ||
Spacer() | ||
Text(page) | ||
Spacer() | ||
} | ||
.padding(.top, ContentDimension.interSpacing) | ||
.readableInsetsPadding([.bottom, .horizontal]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// QuranPageHeader.swift | ||
// | ||
// | ||
// Created by Mohamed Afifi on 2024-02-10. | ||
// | ||
|
||
import SwiftUI | ||
|
||
public struct QuranPageHeader: View { | ||
private let quarterName: String | ||
private let suraNames: MultipartText | ||
|
||
public init(quarterName: String, suraNames: MultipartText) { | ||
self.quarterName = quarterName | ||
self.suraNames = suraNames | ||
} | ||
|
||
public var body: some View { | ||
HStack { | ||
Text(quarterName) | ||
Spacer() | ||
suraNames | ||
.view(ofSize: .footnote, alignment: .trailing) | ||
} | ||
.readableInsetsPadding([.top, .horizontal]) | ||
.padding(.bottom, ContentDimension.interSpacing) | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.