Skip to content

Commit

Permalink
Screens for searching the explore page (#80)
Browse files Browse the repository at this point in the history
Co-authored-by: aravgoyal <[email protected]>
Co-authored-by: Ryan Saperstein <[email protected]>
  • Loading branch information
3 people authored Dec 4, 2024
1 parent ba39f0a commit 0d7cd5b
Show file tree
Hide file tree
Showing 40 changed files with 2,994 additions and 2,240 deletions.
Binary file added frontend/assets/images/Logo x 100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions frontend/assets/images/error.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 17 additions & 17 deletions frontend/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo', '@babel/preset-typescript'],
plugins: [
'@babel/plugin-transform-react-jsx',
'nativewind/babel',
[
'module:react-native-dotenv',
{
moduleName: '@env',
path: '.env',
},
],
],
};
};
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo', '@babel/preset-typescript'],
plugins: [
'@babel/plugin-transform-react-jsx',
'nativewind/babel',
[
'module:react-native-dotenv',
{
moduleName: '@env',
path: '.env',
},
],
],
};
};
130 changes: 110 additions & 20 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 25 additions & 25 deletions frontend/src/components/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import React from 'react';
import { View, ViewProps } from 'react-native';
import { styled } from 'nativewind';
import { cva, type VariantProps } from 'class-variance-authority';

const StyledView = styled(View);

const cardVariants = cva('bg-white rounded-[16px] border border-border p-4', {
variants: {},
defaultVariants: {},
});

interface CardProps extends ViewProps, VariantProps<typeof cardVariants> {
children: React.ReactNode;
}

export function Card({ children, className, ...props }: CardProps & { className?: string }) {
return (
<StyledView className={`${cardVariants()} ${className || ''}`} {...props}>
{children}
</StyledView>
);
}

export default Card;
import React from 'react';
import { View, ViewProps } from 'react-native';
import { styled } from 'nativewind';
import { cva, type VariantProps } from 'class-variance-authority';

const StyledView = styled(View);

const cardVariants = cva('bg-white rounded-[16px] border border-border p-4', {
variants: {},
defaultVariants: {},
});

interface CardProps extends ViewProps, VariantProps<typeof cardVariants> {
children: React.ReactNode;
}

export function Card({ children, className, ...props }: CardProps & { className?: string }) {
return (
<StyledView className={`${cardVariants()} ${className || ''}`} {...props}>
{children}
</StyledView>
);
}

export default Card;
2 changes: 1 addition & 1 deletion frontend/src/components/Divider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { View, Image, ImageSourcePropType } from 'react-native';
import { styled } from 'nativewind';
import { CaptionText } from './Typography';
import { CaptionText } from './typography';

const StyledView = styled(View);
const StyledImage = styled(Image);
Expand Down
15 changes: 12 additions & 3 deletions frontend/src/components/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,35 @@ const iconVariants = {
'search-disabled': require('../../assets/images/search-icon-disabled.png'),
};

const { height: screenHeight } = Dimensions.get('window');
const calculatedWidth = (239 / 1000) * screenHeight;
const calculatedHeight = (42 / 1000) * screenHeight;


type SearchBarProps = VariantProps<typeof searchBarVariants> & {
value: string;
onValueChange: (text: string) => void;
onPressed: (event: GestureResponderEvent) => void;
onSubmit: (event: GestureResponderEvent) => void;
intent: string;
icon: string;
textColor: string;
width: number;
height: number;
};

const SearchBar: React.FC<SearchBarProps> = ({
value,
intent,
icon,
textColor,
width,
height,
onValueChange,
onPressed,
onSubmit,
}) => {

const { height: screenHeight, width: screenWidth } = Dimensions.get('window');
const calculatedWidth = (width / 100) * screenWidth;
const calculatedHeight = (height / 100) * screenHeight;
return (
<StyledView
className={searchBarVariants({ intent, icon })}
Expand All @@ -69,6 +77,7 @@ const SearchBar: React.FC<SearchBarProps> = ({
placeholder={value}
placeholderTextColor={textColor}
onChangeText={onValueChange}
onSubmitEditing={onSubmit}
/>
<StyledPressable className='ml-2' onPress={onPressed}>
<StyledImage source={iconVariants[icon || 'clear']} style={{ width: 14, height: 14 }} />
Expand Down
Loading

0 comments on commit 0d7cd5b

Please sign in to comment.