frontend client for gemstone. decentralised workplace app

feat: lighten on hover

lighten and darken functions were implemented wrongly

serenity eebce5a7 b6178468

Changed files
+72 -48
src
components
lib
facet
src
lib
+33 -21
src/components/Settings/LatticeSettings.tsx
···
import { LatticeInfo } from "@/components/Settings/LatticeInfo";
import { RegisterLatticeModalContent } from "@/components/Settings/RegisterLatticeModalContent";
import { useFacet } from "@/lib/facet";
-
import { fade } from "@/lib/facet/src/lib/colors";
import type { AtUri } from "@/lib/types/atproto";
import { stringToAtUri } from "@/lib/utils/atproto";
import { useOAuthSessionGuaranteed } from "@/providers/OAuthProvider";
···
)}
<View>
<Pressable
-
style={{
-
flexDirection: "row",
-
alignItems: "center",
-
marginLeft: 10,
-
gap: 4,
-
backgroundColor: semantic.primary,
-
alignSelf: "flex-start",
-
padding: 8,
-
paddingRight: 12,
-
borderRadius: atoms.radii.md,
-
}}
onPress={() => {
setShowRegisterModal(true);
}}
>
-
<Plus height={16} width={16} color={semantic.textInverse} />
-
<Text
-
style={[
-
typography.weights.byName.normal,
-
{ color: semantic.textInverse },
-
]}
-
>
-
Register a Lattice
-
</Text>
</Pressable>
<Modal
visible={showRegisterModal}
···
import { LatticeInfo } from "@/components/Settings/LatticeInfo";
import { RegisterLatticeModalContent } from "@/components/Settings/RegisterLatticeModalContent";
import { useFacet } from "@/lib/facet";
+
import { fade, lighten } from "@/lib/facet/src/lib/colors";
import type { AtUri } from "@/lib/types/atproto";
import { stringToAtUri } from "@/lib/utils/atproto";
import { useOAuthSessionGuaranteed } from "@/providers/OAuthProvider";
···
)}
<View>
<Pressable
+
style={{ alignSelf: "flex-start", marginLeft: 10 }}
onPress={() => {
setShowRegisterModal(true);
}}
>
+
{({ hovered }) => (
+
<View
+
style={{
+
flexDirection: "row",
+
alignItems: "center",
+
+
gap: 4,
+
backgroundColor: hovered
+
? lighten(semantic.primary, 5)
+
: semantic.primary,
+
alignSelf: "flex-start",
+
padding: 8,
+
paddingRight: 12,
+
borderRadius: atoms.radii.md,
+
}}
+
>
+
<Plus
+
height={16}
+
width={16}
+
color={semantic.textInverse}
+
/>
+
<Text
+
style={[
+
typography.weights.byName.normal,
+
{ color: semantic.textInverse },
+
]}
+
>
+
Register a Lattice
+
</Text>
+
</View>
+
)}
</Pressable>
<Modal
visible={showRegisterModal}
+33 -21
src/components/Settings/ShardSettings.tsx
···
import { RegisterShardModalContent } from "@/components/Settings/RegisterShardModalContent";
import { ShardInfo } from "@/components/Settings/ShardInfo";
import { useFacet } from "@/lib/facet";
-
import { fade } from "@/lib/facet/src/lib/colors";
import type { AtUri } from "@/lib/types/atproto";
import { stringToAtUri } from "@/lib/utils/atproto";
import { useOAuthSessionGuaranteed } from "@/providers/OAuthProvider";
···
)}
<View>
<Pressable
-
style={{
-
flexDirection: "row",
-
alignItems: "center",
-
marginLeft: 10,
-
gap: 4,
-
backgroundColor: semantic.primary,
-
alignSelf: "flex-start",
-
padding: 8,
-
paddingRight: 12,
-
borderRadius: atoms.radii.md,
-
}}
onPress={() => {
setShowRegisterModal(true);
}}
>
-
<Plus height={16} width={16} color={semantic.textInverse} />
-
<Text
-
style={[
-
typography.weights.byName.normal,
-
{ color: semantic.textInverse },
-
]}
-
>
-
Register a Shard
-
</Text>
</Pressable>
<Modal
visible={showRegisterModal}
···
import { RegisterShardModalContent } from "@/components/Settings/RegisterShardModalContent";
import { ShardInfo } from "@/components/Settings/ShardInfo";
import { useFacet } from "@/lib/facet";
+
import { fade, lighten } from "@/lib/facet/src/lib/colors";
import type { AtUri } from "@/lib/types/atproto";
import { stringToAtUri } from "@/lib/utils/atproto";
import { useOAuthSessionGuaranteed } from "@/providers/OAuthProvider";
···
)}
<View>
<Pressable
+
style={{ alignSelf: "flex-start", marginLeft: 10 }}
onPress={() => {
setShowRegisterModal(true);
}}
>
+
{({ hovered }) => (
+
<View
+
style={{
+
flexDirection: "row",
+
alignItems: "center",
+
+
gap: 4,
+
backgroundColor: hovered
+
? lighten(semantic.primary, 5)
+
: semantic.primary,
+
alignSelf: "flex-start",
+
padding: 8,
+
paddingRight: 12,
+
borderRadius: atoms.radii.md,
+
}}
+
>
+
<Plus
+
height={16}
+
width={16}
+
color={semantic.textInverse}
+
/>
+
<Text
+
style={[
+
typography.weights.byName.normal,
+
{ color: semantic.textInverse },
+
]}
+
>
+
Register a Shard
+
</Text>
+
</View>
+
)}
</Pressable>
<Modal
visible={showRegisterModal}
+6 -6
src/lib/facet/src/lib/colors.ts
···
const hsl = hexToHsl(hex);
if (typeof method !== "undefined") {
-
hsl.l += (hsl.l * amount) / 100;
} else {
-
hsl.l += amount / 100;
}
-
hsl.l = clamp(hsl.l);
return hslToHex(hsl);
};
···
const hsl = hexToHsl(hex);
if (typeof method !== "undefined") {
-
hsl.l -= (hsl.l * amount) / 100;
} else {
-
hsl.l -= amount / 100;
}
-
hsl.l = clamp(hsl.l);
return hslToHex(hsl);
};
···
const hsl = hexToHsl(hex);
if (typeof method !== "undefined") {
+
hsl.l += hsl.l * amount;
} else {
+
hsl.l += amount;
}
+
hsl.l = clamp(hsl.l / 100) * 100;
return hslToHex(hsl);
};
···
const hsl = hexToHsl(hex);
if (typeof method !== "undefined") {
+
hsl.l -= hsl.l * amount;
} else {
+
hsl.l -= amount;
}
+
hsl.l = clamp(hsl.l / 100) * 100;
return hslToHex(hsl);
};