-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ui): add reciept boilerplate #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
JosephMart
wants to merge
3
commits into
main
Choose a base branch
from
j/barebones-reciept
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,19 @@ | ||
| /* SPDX-License-Identifier: AGPL-3.0-or-later | ||
| * | ||
| * SPDX-FileCopyrightText: 2024 Joseph Martinsen <joseph@martinsen.com> | ||
| */ | ||
| { | ||
| // Use IntelliSense to learn about possible attributes. | ||
| // Hover to view descriptions of existing attributes. | ||
| // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
| "version": "0.2.0", | ||
| "configurations": [ | ||
| { | ||
| "type": "chrome", | ||
| "request": "launch", | ||
| "name": "Launch Chrome against localhost", | ||
| "url": "https://studious-space-chainsaw-q75x57g4jg5hq4q-5173.app.github.dev", | ||
| "webRoot": "${workspaceFolder}" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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,28 @@ | ||
| /* SPDX-License-Identifier: AGPL-3.0-or-later | ||
| * | ||
| * SPDX-FileCopyrightText: 2024 Joseph Martinsen <joseph@martinsen.com> | ||
| */ | ||
|
|
||
| .header { | ||
| background: #555; | ||
| color: #f1f1f1; | ||
| z-index: 1; | ||
| } | ||
|
|
||
| .sticky { | ||
| position: fixed; | ||
| top: 0; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .profile-list-container { | ||
| width: 100%; | ||
| overflow-x: auto; | ||
| padding: 10px 0; | ||
| } | ||
|
|
||
| .profile-list { | ||
| display: flex; | ||
| flex-direction: row; | ||
| gap: 10px; | ||
| } |
This file contains hidden or 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,52 @@ | ||
| /* SPDX-License-Identifier: AGPL-3.0-or-later | ||
| * | ||
| * SPDX-FileCopyrightText: 2024 Joseph Martinsen <joseph@martinsen.com> | ||
| */ | ||
|
|
||
| import { useReducer } from "react"; | ||
| import "./FacePile.css"; | ||
| import UserIcon, { UserIconProps } from "./UserIcon"; | ||
|
|
||
| type SplitUser = Omit<UserIconProps, "onRemove">; | ||
|
|
||
| function splitUserReducer(state: SplitUser[], action: {type: "add" | "remove", item: SplitUser}) { | ||
| switch (action.type) { | ||
| case "add": | ||
| return [...state, action.item]; | ||
| case "remove": | ||
| return state.filter(item => item !== action.item) | ||
| default: | ||
| return state; | ||
| } | ||
| } | ||
|
|
||
| function useSplitUser() { | ||
| return useReducer(splitUserReducer, []); | ||
| } | ||
|
|
||
| function FacePile() { | ||
| const [splitUsers, dispatchSplitUser] = useSplitUser(); | ||
|
|
||
| function removeSplitUser(user: SplitUser) { | ||
| dispatchSplitUser({ type: "remove", item: user}) | ||
| } | ||
|
|
||
| return ( | ||
| <div className="header sticky"> | ||
| <div className="profile-list-container"> | ||
| <div className="profile-list"> | ||
| {splitUsers.map((splitUser, index) => ( | ||
| <div className="profile-item" key={index}> | ||
| <UserIcon {...splitUser} onRemove={removeSplitUser} /> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| <button onClick={() => { | ||
| dispatchSplitUser({ type: "add", item: splitUsers.length % 2 ? { type: "img" } : { type: "default" }}) | ||
| }}>Add</button> | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| export default FacePile; |
This file contains hidden or 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,30 @@ | ||
| /* SPDX-License-Identifier: AGPL-3.0-or-later | ||
| * | ||
| * SPDX-FileCopyrightText: 2024 Joseph Martinsen <joseph@martinsen.com> | ||
| */ | ||
|
|
||
| .reciept { | ||
| color: black; | ||
| background-color: white; | ||
| margin-top: 4em; | ||
| padding: 3em 0em; | ||
|
|
||
| --mask: conic-gradient(from -47.5deg at bottom,#0000,#000 1deg 94deg,#0000 95deg) 50%/65.48px 100%; | ||
| -webkit-mask: var(--mask); | ||
| mask: var(--mask); | ||
| } | ||
|
|
||
| .reciept-title { | ||
| border: none; | ||
| background: white; | ||
| color: black; | ||
| font-family: inherit; | ||
| font-size: inherit; | ||
| font-style: italic; | ||
| } | ||
|
|
||
| .title { | ||
| text-decoration: underline; | ||
| border-bottom: 1px solid black; | ||
| } | ||
|
|
This file contains hidden or 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,18 @@ | ||
| /* SPDX-License-Identifier: AGPL-3.0-or-later | ||
| * | ||
| * SPDX-FileCopyrightText: 2024 Joseph Martinsen <joseph@martinsen.com> | ||
| */ | ||
|
|
||
| import { useState } from "react"; | ||
| import "./Reciept.css" | ||
|
|
||
| function Reciept() { | ||
| const [title, updateTitle] = useState("Location"); | ||
| return <div className="reciept"> | ||
| <h1 className="title"> | ||
| GoSplitsies:<input className="reciept-title" value={title} onChange={e => updateTitle(e.target.value)} /> | ||
| </h1> | ||
| </div> | ||
| } | ||
|
|
||
| export default Reciept; |
This file contains hidden or 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,39 @@ | ||
| /* SPDX-License-Identifier: AGPL-3.0-or-later | ||
| * | ||
| * SPDX-FileCopyrightText: 2024 Joseph Martinsen <joseph@martinsen.com> | ||
| */ | ||
|
|
||
|
|
||
| .profile-item { | ||
| flex: 0 0 auto; | ||
| width: 60px; | ||
| height: 60px; | ||
| border-radius: 50%; | ||
| overflow: hidden; | ||
| border: 2px solid #ccc; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| background-color: #f0f0f0; /* Light gray background for the default avatar */ | ||
| } | ||
|
|
||
| .profile-item img { | ||
| width: 100%; | ||
| height: 100%; | ||
| object-fit: cover; | ||
| border-radius: 50%; | ||
| } | ||
|
|
||
| .default-avatar { | ||
| width: 100%; | ||
| height: 100%; | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: center; | ||
| background-color: #007bff; /* Blue background for default avatar */ | ||
| color: #fff; | ||
| font-size: 24px; | ||
| font-weight: bold; | ||
| border-radius: 50%; | ||
| text-transform: uppercase; | ||
| } |
This file contains hidden or 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,41 @@ | ||
| /* SPDX-License-Identifier: AGPL-3.0-or-later | ||
| * | ||
| * SPDX-FileCopyrightText: 2024 Joseph Martinsen <joseph@martinsen.com> | ||
| */ | ||
|
|
||
| import "./UserIcon.css" | ||
|
|
||
| function DefaultIcon() { | ||
| return ( | ||
| <div className="default-avatar"> | ||
| {/* TODO: {profile.name.charAt(0).toUpperCase()} */} | ||
| J | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| function ImgUserIcon() { | ||
| return <img className="user-icon-outline" src="https://picsum.photos/50" /> | ||
| } | ||
|
|
||
|
|
||
| export type UserIconProps = { | ||
| type: "img" | ||
| img?: string; | ||
| onRemove: (item: UserIconProps) => void; | ||
| } | { type: "default" | "add"} | ||
|
|
||
| function UserIcon(props: UserIconProps) { | ||
| switch(props.type) { | ||
| case "default": | ||
| return <DefaultIcon />; | ||
| case "img": | ||
| return <ImgUserIcon /> | ||
| case "add": | ||
| return <div> | ||
| <p>ADD</p> | ||
| </div> | ||
| } | ||
| } | ||
|
|
||
| export default UserIcon; |
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -29,18 +29,18 @@ a:hover { | |
|
|
||
| body { | ||
| margin: 0; | ||
| display: flex; | ||
| place-items: center; | ||
| min-width: 320px; | ||
| min-height: 100vh; | ||
| /* display: flex; */ | ||
| /* place-items: center; */ | ||
| /* min-width: 320px; */ | ||
| /* min-height: 100vh; */ | ||
|
Comment on lines
+32
to
+35
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Delete?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is currently a draft PR 😛 |
||
| } | ||
|
|
||
| h1 { | ||
| font-size: 3.2em; | ||
| line-height: 1.1; | ||
| } | ||
|
|
||
| button { | ||
| /* button { | ||
| border-radius: 8px; | ||
| border: 1px solid transparent; | ||
| padding: 0.6em 1.2em; | ||
|
|
@@ -57,7 +57,7 @@ button:hover { | |
| button:focus, | ||
| button:focus-visible { | ||
| outline: 4px auto -webkit-focus-ring-color; | ||
| } | ||
| } */ | ||
|
|
||
| @media (prefers-color-scheme: light) { | ||
| :root { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we delete these?