-
Notifications
You must be signed in to change notification settings - Fork 0
Lists #3
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
Open
chrisdrackett
wants to merge
30
commits into
main
Choose a base branch
from
lists
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.
Open
Lists #3
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
a458b01
working on cleaning up and simplifying lists
chrisdrackett d6b28a4
remove yarn.lock from paradigm
chrisdrackett 6091ee3
Revert "remove yarn.lock from paradigm"
chrisdrackett c0e96f4
remove console.log
chrisdrackett d19ae53
update paradigm to not have a lockfile to support monorepos
chrisdrackett 8d76bf9
allow local PRs without lockfiles to build
chrisdrackett 07d43e7
ignore yarn.lock
chrisdrackett 34c0188
more list cleanup
chrisdrackett 9bcf061
add quick spring
chrisdrackett 929a1cf
link chromatic
chrisdrackett b1fdc83
pulling in official window splitter fix
chrisdrackett 14f2b44
update icons and other components to all use the same color value
chrisdrackett 01d363c
nums to dict
chrisdrackett 3c4ad27
adding theme values
chrisdrackett 9698ac0
more work on icon types
chrisdrackett bd9dd84
starting work on settings lists
chrisdrackett 1fdcc97
update to tamagui 2.0
chrisdrackett a292f21
reconcile icon sizing types
chrisdrackett 48b27c9
fix default positon
chrisdrackett 9963922
remove unused setting
chrisdrackett 1b4518c
type and tamagui clean up
chrisdrackett 49744c4
more work on info settings list item
chrisdrackett 28935f3
info settings item
chrisdrackett f4e6041
add switch
chrisdrackett 4dad86a
update theme support
chrisdrackett 422ea06
pull pressable out into its own component
chrisdrackett b521bfa
initial slider
chrisdrackett d3b0415
finish first pass on slider
chrisdrackett 4121e80
first pass on select settings item
chrisdrackett 9c8c3fa
add system as an option
chrisdrackett 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
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 |
|---|---|---|
|
|
@@ -27,4 +27,7 @@ storybook-static | |
| .tamagui | ||
|
|
||
| # env | ||
| .env | ||
| .env | ||
|
|
||
| # for monorepo use | ||
| yarn.lock | ||
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,5 @@ | ||
| { | ||
| "onlyChanged": true, | ||
| "projectId": "Project:62fea75bb5d432cf221355c3", | ||
| "zip": true | ||
| } | ||
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 |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ words: | |
| - culori | ||
| - mongolyy | ||
| - nderscore | ||
| - nums | ||
| - unplugin | ||
| ignoreWords: [] | ||
| import: [] | ||
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
Empty file.
This file was deleted.
Oops, something went wrong.
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,31 @@ | ||
| import React from "react" | ||
|
|
||
| import { Text } from "../Text" | ||
|
|
||
| /** | ||
| * Text to show after an element. Used mostly for lists. | ||
| */ | ||
| type AfterTextProps = { | ||
| /** | ||
| * The text to show. Note that this is rendred within a `Text` node. | ||
| */ | ||
| children: string | React.ReactNode | ||
| } | ||
|
|
||
| export const AfterText = React.memo(function AfterText({ | ||
| children, | ||
| }: AfterTextProps) { | ||
| return ( | ||
| <Text | ||
| noUserSelect | ||
| style={Text.style.footnote} | ||
| fit={Text.fitValues.wrap} | ||
| px={"$edgeInset"} | ||
| py={"$captionVerticalMargin"} | ||
| color={"$secondaryColor"} | ||
| _style={{ flexShrink: 0 }} | ||
| > | ||
| {children} | ||
| </Text> | ||
| ) | ||
| }) |
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,183 @@ | ||
| import React from "react" | ||
| import { useTheme } from "tamagui" | ||
|
|
||
| import { usePointerEvents } from "../../hooks/usePointerEvents" | ||
| import { useShadow as getShadow } from "../../hooks/useShadow" | ||
| import { MotionView, ViewContext, type ViewProps } from "../View" | ||
|
|
||
| import type { ColorValue } from "../../utils/color" | ||
| import type { OnPressWithRef } from "../../utils/types" | ||
|
|
||
| export type PressableState = { | ||
| isHovered: boolean | ||
| isActive: boolean | ||
| } | ||
|
|
||
| export type ParadigmPressableProps = ViewProps & { | ||
| /** | ||
| * what happens when the element is pressed? | ||
| * | ||
| * This is `OnPressWithRef` so its possible to find the element when needed (popups, etc.) | ||
| */ | ||
| onPress?: OnPressWithRef | ||
| /** | ||
| * Called whenever hover or active state changes. | ||
| */ | ||
| onStateChange?: (state: PressableState) => void | ||
| /** | ||
| * is this element important? Should only be 1 per page. | ||
| */ | ||
| isPrimary?: boolean | ||
| /** | ||
| * Does this element have a negative effect (delete, etc.) | ||
| */ | ||
| isNegative?: boolean | ||
| /** | ||
| * Is this element floating? | ||
| */ | ||
| isRaised?: boolean | ||
| /** | ||
| * is this element disabled? | ||
| * This will make `onPress` not work even if defined | ||
| */ | ||
| isDisabled?: boolean | ||
| /** | ||
| * Is this element currently in a loading state. | ||
| * This will disable `onPress` even if defined | ||
| */ | ||
| isLoading?: boolean | ||
| } | ||
|
|
||
| const { all: e1 } = getShadow({ | ||
| shadowName: "elevation1", | ||
| forceBoxShadow: true, | ||
| }) | ||
| const { all: e2 } = getShadow({ | ||
| shadowName: "elevation2", | ||
| forceBoxShadow: true, | ||
| }) | ||
|
|
||
| export const Pressable = ({ | ||
| children, | ||
| onPress, | ||
| onStateChange, | ||
| isPrimary, | ||
| isNegative, | ||
| isRaised, | ||
| isDisabled: isMarkedDisabled = false, | ||
| isLoading, | ||
| ...otherProps | ||
| }: ParadigmPressableProps) => { | ||
| const theme = useTheme() | ||
| const { color: parentColor } = React.useContext(ViewContext) | ||
| const { isHovered, isActive, pointerProps } = usePointerEvents() | ||
|
|
||
| React.useEffect(() => { | ||
| onStateChange?.({ isHovered, isActive }) | ||
| }, [isHovered, isActive, onStateChange]) | ||
| const pressableRef = React.useRef(null) | ||
|
|
||
| let backgroundColor: ColorValue | ||
|
|
||
| // the button is disabled both when loading and when actively marked disabled | ||
| const isDisabled = isMarkedDisabled || isLoading | ||
|
|
||
| const buttonState = isDisabled | ||
| ? isLoading | ||
| ? "loading" | ||
| : "disabled" | ||
| : isHovered | ||
| ? isActive | ||
| ? "hoverActive" | ||
| : "hover" | ||
| : isActive | ||
| ? "active" | ||
| : "normal" | ||
|
|
||
| // Background Color | ||
| const raisedColor = parentColor | ||
| ? parentColor.toString() !== "$background" | ||
| ? theme.background | ||
| : theme.cardStock | ||
| : theme.cardStock | ||
|
|
||
| switch (buttonState) { | ||
| case "loading": | ||
| case "disabled": { | ||
| backgroundColor = theme.cardStock | ||
| break | ||
| } | ||
| case "hover": { | ||
| backgroundColor = isPrimary | ||
| ? isNegative | ||
| ? theme.negativeHover | ||
| : theme.primaryHover | ||
| : isRaised | ||
| ? raisedColor | ||
| : theme.normalHover | ||
| break | ||
| } | ||
| case "active": | ||
| case "hoverActive": { | ||
| backgroundColor = isPrimary | ||
| ? isNegative | ||
| ? theme.negativeActive | ||
| : theme.primaryActive | ||
| : isRaised | ||
| ? raisedColor | ||
| : theme.normalActive | ||
| break | ||
| } | ||
| default: { | ||
| // normal | ||
| if (isPrimary) { | ||
| if (isNegative) { | ||
| backgroundColor = theme.destructive | ||
| } else { | ||
| backgroundColor = theme.primary | ||
| } | ||
| } else { | ||
| if (isRaised) { | ||
| backgroundColor = raisedColor | ||
| } else { | ||
| backgroundColor = theme.cardStock | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return ( | ||
| <MotionView | ||
| ref={pressableRef} | ||
| center | ||
| noShrink | ||
| color={backgroundColor} | ||
| _tamaguiProps={{ flexDirection: "row" }} | ||
| {...otherProps} | ||
| {...pointerProps} | ||
| disabled={isDisabled ?? false} | ||
| cursor={isDisabled ? "not-allowed" : "pointer"} | ||
| variants={{ | ||
| normal: { filter: "none" }, | ||
| raised: { y: -1, filter: e1.filter ?? "none", boxShadow: e1.boxShadow }, | ||
| hover: { y: -3, filter: e2.filter ?? "none", boxShadow: e2.boxShadow }, | ||
| active: { y: 0, filter: e1.filter ?? "none", boxShadow: e1.boxShadow }, | ||
| }} | ||
| animate={ | ||
| isRaised && !isDisabled | ||
| ? isHovered | ||
| ? isActive | ||
| ? "active" | ||
| : "hover" | ||
| : "raised" | ||
| : "normal" | ||
| } | ||
| transition={{ type: "spring", visualDuration: 0.35, bounce: 0.35 }} | ||
| onPress={(event) => { | ||
| onPress?.({ ref: pressableRef, event }) | ||
| }} | ||
| > | ||
| {children} | ||
| </MotionView> | ||
| ) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
[Biome] reported by reviewdog 🐶