mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
refactor
This commit is contained in:
@@ -5,7 +5,13 @@ import { SIZE } from '../../../utils/size';
|
|||||||
import { IconButton } from '../icon-button';
|
import { IconButton } from '../icon-button';
|
||||||
import Paragraph from '../typography/paragraph';
|
import Paragraph from '../typography/paragraph';
|
||||||
|
|
||||||
export const Notice = ({ type, text, size }) => {
|
export interface NoticeProps {
|
||||||
|
type?: 'alert' | 'information';
|
||||||
|
text: string;
|
||||||
|
size?: 'small' | 'large';
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Notice = ({ type = 'alert', text, size = 'large' }: NoticeProps) => {
|
||||||
const colors = useThemeStore(state => state.colors);
|
const colors = useThemeStore(state => state.colors);
|
||||||
const isSmall = size === 'small';
|
const isSmall = size === 'small';
|
||||||
|
|
||||||
@@ -22,8 +28,8 @@ export const Notice = ({ type, text, size }) => {
|
|||||||
size={isSmall ? SIZE.xs + 1 : SIZE.xxl}
|
size={isSmall ? SIZE.xs + 1 : SIZE.xxl}
|
||||||
name={type}
|
name={type}
|
||||||
customStyle={{
|
customStyle={{
|
||||||
width: isSmall ? null : 40,
|
width: isSmall ? undefined : 40,
|
||||||
height: isSmall ? null : 40
|
height: isSmall ? undefined : 40
|
||||||
}}
|
}}
|
||||||
color={type === 'alert' ? colors.errorText : colors.accent}
|
color={type === 'alert' ? colors.errorText : colors.accent}
|
||||||
/>
|
/>
|
||||||
@@ -2,9 +2,8 @@ import React from 'react';
|
|||||||
import { Platform, View } from 'react-native';
|
import { Platform, View } from 'react-native';
|
||||||
import ActionSheet from 'react-native-actions-sheet';
|
import ActionSheet from 'react-native-actions-sheet';
|
||||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
import { useThemeStore } from '../../../stores/theme';
|
|
||||||
import { useSettingStore } from '../../../stores/stores';
|
import { useSettingStore } from '../../../stores/stores';
|
||||||
import layoutmanager from '../../../utils/layout-manager';
|
import { useThemeStore } from '../../../stores/theme';
|
||||||
import { PremiumToast } from '../../premium/premium-toast';
|
import { PremiumToast } from '../../premium/premium-toast';
|
||||||
import { Toast } from '../../toast';
|
import { Toast } from '../../toast';
|
||||||
import { BouncingView } from '../transitions/bouncing-view';
|
import { BouncingView } from '../transitions/bouncing-view';
|
||||||
@@ -58,8 +57,6 @@ const SheetWrapper = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('Sheet keyboard handler', sheetKeyboardHandler);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ActionSheet
|
<ActionSheet
|
||||||
ref={fwdRef}
|
ref={fwdRef}
|
||||||
|
|||||||
@@ -1,21 +1,15 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Platform } from 'react-native';
|
import { Platform, TextProps } from 'react-native';
|
||||||
import { Text } from 'react-native';
|
import { Text } from 'react-native';
|
||||||
import { useThemeStore } from '../../../stores/theme';
|
import { useThemeStore } from '../../../stores/theme';
|
||||||
import { SIZE } from '../../../utils/size';
|
import { SIZE } from '../../../utils/size';
|
||||||
|
|
||||||
/**
|
interface HeadingProps extends TextProps {
|
||||||
*
|
color?: string;
|
||||||
* @typedef {import('react-native').TextProps} TextType
|
size?: number;
|
||||||
* @typedef {Object} restTypes
|
}
|
||||||
* @property {string} color color
|
|
||||||
* @property {number} size color
|
const Heading = ({ color, size = SIZE.xl, style, ...restProps }: HeadingProps) => {
|
||||||
*/
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {TextType | restTypes} props all props
|
|
||||||
*/
|
|
||||||
const Heading = ({ color, size = SIZE.xl, style, ...restProps }) => {
|
|
||||||
const colors = useThemeStore(state => state.colors);
|
const colors = useThemeStore(state => state.colors);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -27,8 +21,8 @@ const Heading = ({ color, size = SIZE.xl, style, ...restProps }) => {
|
|||||||
{
|
{
|
||||||
fontSize: size || SIZE.xl,
|
fontSize: size || SIZE.xl,
|
||||||
color: color || colors.heading,
|
color: color || colors.heading,
|
||||||
fontFamily: Platform.OS === 'android' ? 'OpenSans-SemiBold' : null,
|
fontFamily: Platform.OS === 'android' ? 'OpenSans-SemiBold' : undefined,
|
||||||
fontWeight: Platform.OS === 'ios' ? '600' : null
|
fontWeight: Platform.OS === 'ios' ? '600' : undefined
|
||||||
},
|
},
|
||||||
style
|
style
|
||||||
]}
|
]}
|
||||||
@@ -1,20 +1,14 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Text } from 'react-native';
|
import { Text, TextProps } from 'react-native';
|
||||||
import { useThemeStore } from '../../../stores/theme';
|
import { useThemeStore } from '../../../stores/theme';
|
||||||
import { SIZE } from '../../../utils/size';
|
import { SIZE } from '../../../utils/size';
|
||||||
|
|
||||||
/**
|
interface ParagraphProps extends TextProps {
|
||||||
*
|
color?: string;
|
||||||
* @typedef {import('react-native').TextProps} TextType
|
size?: number;
|
||||||
* @typedef {Object} restTypes
|
}
|
||||||
* @property {string} color color
|
|
||||||
* @property {number} size color
|
const Paragraph = ({ color, size = SIZE.sm, style, ...restProps }: ParagraphProps) => {
|
||||||
*/
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {TextType | restTypes} props all props
|
|
||||||
*/
|
|
||||||
const Paragraph = ({ color, size = SIZE.sm, style, ...restProps }) => {
|
|
||||||
const colors = useThemeStore(state => state.colors);
|
const colors = useThemeStore(state => state.colors);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
import React, { useCallback, useEffect } from 'react';
|
import React, { useCallback, useEffect } from 'react';
|
||||||
import { ContainerHeader } from '../../components/container/containerheader';
|
import { ContainerHeader } from '../../components/container/containerheader';
|
||||||
import { Header } from '../../components/header';
|
import { Header } from '../../components/header';
|
||||||
import { Placeholder } from '../../components/ui/svg';
|
|
||||||
import SelectionHeader from '../../components/selection-header';
|
|
||||||
import List from '../../components/list';
|
import List from '../../components/list';
|
||||||
import { useTagStore } from '../../stores/stores';
|
import SelectionHeader from '../../components/selection-header';
|
||||||
import Navigation from '../../services/navigation';
|
import Navigation from '../../services/navigation';
|
||||||
import SearchService from '../../services/search';
|
import SearchService from '../../services/search';
|
||||||
|
import { useTagStore } from '../../stores/stores';
|
||||||
import { InteractionManager } from '../../utils';
|
import { InteractionManager } from '../../utils';
|
||||||
|
|
||||||
export const Tags = ({ navigation }) => {
|
export const Tags = ({ navigation }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user