Skip to content
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

Screens for searching the explore page #80

Merged
merged 17 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading