Compare commits

...

13 Commits

Author SHA1 Message Date
Eric Bailey 701b0a0a0e Always a circle 2024-09-26 10:08:06 -05:00
Eric Bailey 1e3cea434c Merge remote-tracking branch 'origin/main' into left-nav-desktop
* origin/main:
  Adjust line height to not cut off emoji (#5496)
  Emoji in account list (#5497)
  Make the counter more rounded (#5083)
  add emoji prop to composer reply to text (#5495)
  Fix banner height in edit profile modal (#5494)
  Messages list - make avatars link to profile (#5484)
  Add back empty placeholder (#5489)
  Filter errors that get sent to Sentry (#5247)
  Add language filtering UI to search (#5459)
2024-09-26 10:05:31 -05:00
Eric Bailey 84a36e3ba2 Adjust position of counter 2024-09-26 10:03:05 -05:00
Eric Bailey 06d177eb54 Solid 2024-09-26 09:52:30 -05:00
Eric Bailey 38e748a294 Tweak gradient 2024-09-25 17:20:46 -05:00
Eric Bailey 6e05e7d528 Tweak gradient 2024-09-25 17:17:40 -05:00
Eric Bailey 10ca29a067 Tweak gradient 2024-09-25 17:07:19 -05:00
Eric Bailey b4e4ce0f07 Rounded 2024-09-25 16:59:23 -05:00
Eric Bailey 930358a7a3 Z index 2024-09-25 16:48:10 -05:00
Eric Bailey 1d34ef79ab New compose button 2024-09-25 16:46:12 -05:00
Eric Bailey 5a5b124120 Just refactor the thing 2024-09-25 16:32:48 -05:00
Eric Bailey a005f5378e Fix nav item icon width and alignment 2024-09-25 16:04:21 -05:00
Eric Bailey 6022659625 Tweak nav item count style 2024-09-25 16:01:31 -05:00
4 changed files with 68 additions and 93 deletions
+9
View File
@@ -60,6 +60,15 @@ export const fontWeight = {
} as const
export const gradients = {
primary: {
values: [
[0, '#054CFF'],
[0.4, '#1085FE'],
[0.6, '#1085FE'],
[1, '#59B9FF'],
],
hover_value: '#1085FE',
},
sky: {
values: [
[0, '#0A7AFF'],
+5 -4
View File
@@ -24,6 +24,7 @@ export type ButtonColor =
| 'secondary'
| 'secondary_inverted'
| 'negative'
| 'gradient_primary'
| 'gradient_sky'
| 'gradient_midnight'
| 'gradient_sunrise'
@@ -412,6 +413,7 @@ export const Button = React.forwardRef<View, ButtonProps>(
secondary: tokens.gradients.sky,
secondary_inverted: tokens.gradients.sky,
negative: tokens.gradients.sky,
gradient_primary: tokens.gradients.primary,
gradient_sky: tokens.gradients.sky,
gradient_midnight: tokens.gradients.midnight,
gradient_sunrise: tokens.gradients.sunrise,
@@ -444,7 +446,7 @@ export const Button = React.forwardRef<View, ButtonProps>(
[state, variant, color, size, disabled],
)
const flattenedBaseStyles = flatten(baseStyles)
const flattenedBaseStyles = flatten([baseStyles, style])
return (
<Pressable
@@ -464,7 +466,6 @@ export const Button = React.forwardRef<View, ButtonProps>(
a.align_center,
a.justify_center,
flattenedBaseStyles,
flatten(style),
...(state.hovered || state.pressed
? [hoverStyles, flatten(hoverStyleProp)]
: []),
@@ -626,9 +627,9 @@ export function useSharedButtonTextStyles() {
}
if (size === 'large') {
baseStyles.push(a.text_md, a.leading_tight, web({paddingTop: 1}))
baseStyles.push(a.text_md, a.leading_tight, web({top: -0.4}))
} else if (size === 'small') {
baseStyles.push(a.text_sm, a.leading_tight, web({paddingTop: 1}))
baseStyles.push(a.text_sm, a.leading_tight, web({top: -0.4}))
} else if (size === 'tiny') {
baseStyles.push(a.text_xs, a.leading_tight)
}
+1 -1
View File
@@ -1,10 +1,10 @@
import format from 'date-fns/format'
import {nanoid} from 'nanoid/non-secure'
import {isNetworkError} from '#/lib/strings/errors'
import {DebugContext} from '#/logger/debugContext'
import {add} from '#/logger/logDump'
import {Sentry} from '#/logger/sentry'
import {isNetworkError} from 'lib/strings/errors'
import * as env from '#/env'
export enum LogLevel {
+53 -88
View File
@@ -18,7 +18,6 @@ import {getCurrentRoute, isStateAtTabRoot, isTab} from '#/lib/routes/helpers'
import {makeProfileLink} from '#/lib/routes/links'
import {CommonNavigatorParams, NavigationProp} from '#/lib/routes/types'
import {isInvalidHandle} from '#/lib/strings/handles'
import {colors, s} from '#/lib/styles'
import {emitSoftReset} from '#/state/events'
import {useFetchHandle} from '#/state/queries/handle'
import {useUnreadMessageCount} from '#/state/queries/messages/list-converations'
@@ -29,9 +28,10 @@ import {useComposerControls} from '#/state/shell/composer'
import {Link} from '#/view/com/util/Link'
import {LoadingPlaceholder} from '#/view/com/util/LoadingPlaceholder'
import {PressableWithHover} from '#/view/com/util/PressableWithHover'
import {Text} from '#/view/com/util/text/Text'
import {UserAvatar} from '#/view/com/util/UserAvatar'
import {NavSignupCard} from '#/view/shell/NavSignupCard'
import {atoms as a, useBreakpoints, useTheme} from '#/alf'
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
import {
Bell_Filled_Corner0_Rounded as BellFilled,
Bell_Stroke2_Corner0_Rounded as Bell,
@@ -63,6 +63,7 @@ import {
UserCircle_Filled_Corner0_Rounded as UserCircleFilled,
UserCircle_Stroke2_Corner0_Rounded as UserCircle,
} from '#/components/icons/UserCircle'
import {Text} from '#/components/Typography'
import {router} from '../../../routes'
const NAV_ICON_WIDTH = 28
@@ -149,9 +150,10 @@ interface NavItemProps {
label: string
}
function NavItem({count, href, icon, iconFilled, label}: NavItemProps) {
const pal = usePalette('default')
const t = useTheme()
const {currentAccount} = useSession()
const {isDesktop, isTablet} = useWebMediaQueries()
const {gtMobile, gtTablet} = useBreakpoints()
const isTablet = gtMobile && !gtTablet
const [pathName] = React.useMemo(() => router.matchPath(href), [href])
const currentRouteInfo = useNavigationState(state => {
if (!state) {
@@ -183,8 +185,8 @@ function NavItem({count, href, icon, iconFilled, label}: NavItemProps) {
return (
<PressableWithHover
style={styles.navItemWrapper}
hoverStyle={pal.viewLight}
style={[a.flex_row, a.align_center, a.p_md, a.rounded_sm, a.gap_sm]}
hoverStyle={t.atoms.bg_contrast_25}
// @ts-ignore the function signature differs on web -prf
onPress={onPressWrapped}
// @ts-ignore web only -prf
@@ -195,23 +197,50 @@ function NavItem({count, href, icon, iconFilled, label}: NavItemProps) {
accessibilityHint="">
<View
style={[
styles.navItemIconWrapper,
isTablet && styles.navItemIconWrapperTablet,
a.align_center,
a.justify_center,
a.z_10,
{
width: 24,
height: 24,
},
isTablet && {
width: 40,
height: 40,
},
]}>
{isCurrent ? iconFilled : icon}
{typeof count === 'string' && count ? (
<Text
type="button"
style={[
styles.navItemCount,
isTablet && styles.navItemCountTablet,
a.absolute,
a.text_xs,
a.font_bold,
a.rounded_full,
a.text_center,
{
top: '-10%',
left: count.length === 1 ? '50%' : '40%',
backgroundColor: t.palette.primary_500,
color: t.palette.white,
lineHeight: a.text_sm.fontSize,
paddingHorizontal: 4,
paddingVertical: 1,
minWidth: 16,
},
isTablet && [
{
top: '10%',
left: count.length === 1 ? '50%' : '40%',
},
],
]}>
{count}
</Text>
) : null}
</View>
{isDesktop && (
<Text type="title" style={[isCurrent ? s.bold : s.normal, pal.text]}>
{gtTablet && (
<Text style={[a.text_xl, isCurrent ? a.font_heavy : a.font_normal]}>
{label}
</Text>
)}
@@ -268,21 +297,20 @@ function ComposeBtn() {
return null
}
return (
<View style={styles.newPostBtnContainer}>
<TouchableOpacity
<View style={[a.flex_row, a.pl_md, a.pt_xl]}>
<Button
disabled={isFetchingHandle}
style={styles.newPostBtn}
label={_(msg`New post`)}
onPress={onPressCompose}
accessibilityRole="button"
accessibilityLabel={_(msg`New post`)}
accessibilityHint="">
<View style={styles.newPostBtnIconWrapper}>
<EditBig width={19} style={styles.newPostBtnLabel} />
</View>
<Text type="button" style={styles.newPostBtnLabel}>
size="large"
variant="solid"
color="primary"
style={[a.rounded_full]}>
<ButtonIcon icon={EditBig} position="left" />
<ButtonText>
<Trans context="action">New Post</Trans>
</Text>
</TouchableOpacity>
</ButtonText>
</Button>
</View>
)
}
@@ -440,67 +468,4 @@ const styles = StyleSheet.create({
width: 30,
height: 30,
},
navItemWrapper: {
flexDirection: 'row',
alignItems: 'center',
paddingHorizontal: 12,
padding: 12,
borderRadius: 8,
gap: 10,
},
navItemIconWrapper: {
alignItems: 'center',
justifyContent: 'center',
width: 28,
height: 24,
marginTop: 2,
zIndex: 1,
},
navItemIconWrapperTablet: {
width: 40,
height: 40,
},
navItemCount: {
position: 'absolute',
top: 0,
left: 15,
backgroundColor: colors.blue3,
color: colors.white,
fontSize: 12,
fontWeight: '600',
paddingHorizontal: 4,
borderRadius: 8,
},
navItemCountTablet: {
left: 18,
fontSize: 14,
},
newPostBtnContainer: {
flexDirection: 'row',
},
newPostBtn: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
borderRadius: 24,
paddingTop: 10,
paddingBottom: 12, // visually aligns the text vertically inside the button
paddingLeft: 16,
paddingRight: 18, // looks nicer like this
backgroundColor: colors.blue3,
marginLeft: 12,
marginTop: 20,
marginBottom: 10,
gap: 8,
},
newPostBtnIconWrapper: {
marginTop: 2, // aligns the icon visually with the text
},
newPostBtnLabel: {
color: colors.white,
fontSize: 16,
fontWeight: '600',
},
})