-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
228 additions
and
42 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
15 changes: 15 additions & 0 deletions
15
...urces/HorizonUI/Resources/Assets.xcassets/Icons/menu_book_notebook.imageset/Contents.json
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,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "menu_book_notebook.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...ources/Assets.xcassets/Icons/menu_book_notebook.imageset/menu_book_notebook.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions
35
...ources/HorizonUI/Sources/Components/NavigationBar/HorizonUI.NavigationBar.Storybook.swift
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,35 @@ | ||
// | ||
// This file is part of Canvas. | ||
// Copyright (C) 2024-present Instructure, Inc. | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as | ||
// published by the Free Software Foundation, either version 3 of the | ||
// License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
// | ||
|
||
import SwiftUI | ||
public extension HorizonUI.NavigationBar { | ||
struct Storybook: View { | ||
public var body: some View { | ||
VStack { | ||
|
||
} | ||
.navigationBarItems(leading: HorizonUI.NavigationBar.Leading(title: "Hi HorizonUI")) | ||
.navigationBarItems(trailing: HorizonUI.NavigationBar.Trailing(onEvent: { _ in })) | ||
.navigationTitle("NavigationBar") | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
HorizonUI.NavigationBar.Storybook() | ||
} |
42 changes: 42 additions & 0 deletions
42
...s/HorizonUI/Sources/HorizonUI/Sources/Components/NavigationBar/LeadingNavigationBar.swift
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,42 @@ | ||
// | ||
// This file is part of Canvas. | ||
// Copyright (C) 2024-present Instructure, Inc. | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as | ||
// published by the Free Software Foundation, either version 3 of the | ||
// License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
// | ||
|
||
import SwiftUI | ||
|
||
public extension HorizonUI.NavigationBar { | ||
struct Leading: View { | ||
let title: String | ||
|
||
public init(title: String) { | ||
self.title = title | ||
} | ||
|
||
public var body: some View { | ||
Text(title) | ||
.foregroundStyle(Color.huiColors.text.title) | ||
.huiTypography(.p3) | ||
.padding(.huiSpaces.primitives.mediumSmall) | ||
.background(Color.huiColors.surface.pageTertiary) | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
HorizonUI.NavigationBar.Leading(title: "HorizonUI") | ||
} | ||
|
90 changes: 90 additions & 0 deletions
90
.../HorizonUI/Sources/HorizonUI/Sources/Components/NavigationBar/TrailingNavigationBar.swift
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,90 @@ | ||
// | ||
// This file is part of Canvas. | ||
// Copyright (C) 2024-present Instructure, Inc. | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Affero General Public License as | ||
// published by the Free Software Foundation, either version 3 of the | ||
// License, or (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Affero General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Affero General Public License | ||
// along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
// | ||
|
||
import SwiftUI | ||
|
||
public extension HorizonUI.NavigationBar { | ||
struct Trailing: View { | ||
public enum Event { | ||
case mail | ||
case notebook | ||
case notification | ||
} | ||
|
||
private let onEvent: (Event) -> Void | ||
|
||
public init(onEvent: @escaping (Event) -> Void) { | ||
self.onEvent = onEvent | ||
} | ||
|
||
public var body: some View { | ||
HStack(spacing: .zero) { | ||
Button { | ||
onEvent(.notebook) | ||
} label: { | ||
Image.huiIcons.menuBookNotebook | ||
.dropShadow() | ||
} | ||
|
||
Button { | ||
onEvent(.notification) | ||
} label: { | ||
Image.huiIcons.notificationsUnread | ||
.dropShadow() | ||
} | ||
|
||
Button { | ||
onEvent(.mail) | ||
} label: { | ||
Image.huiIcons.mail | ||
.dropShadow() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
HorizonUI.NavigationBar.Trailing { _ in } | ||
} | ||
|
||
fileprivate extension HorizonUI.NavigationBar.Trailing { | ||
struct DropShadowModifire: ViewModifier { | ||
func body(content: Content) -> some View { | ||
content | ||
.foregroundStyle(Color.huiColors.icon.default) | ||
.frame(width: 44, height: 44) | ||
.background { | ||
Rectangle() | ||
.fill(Color.huiColors.surface.pageSecondary) | ||
.huiCornerRadius(level: .level6) | ||
.huiElevation(level: .level4) | ||
} | ||
} | ||
} | ||
} | ||
|
||
fileprivate extension View { | ||
func dropShadow() -> some View { | ||
modifier(HorizonUI.NavigationBar.Trailing.DropShadowModifire()) | ||
} | ||
} | ||
|
||
public extension HorizonUI { | ||
struct NavigationBar {} | ||
} |
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