mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-20 13:39:33 +01:00
fix: ui of topic dialog
This commit is contained in:
@@ -1,19 +1,20 @@
|
|||||||
import React, { createRef } from 'react';
|
import React, {createRef} from 'react';
|
||||||
import { View } from 'react-native';
|
import {View} from 'react-native';
|
||||||
import { TextInput } from 'react-native-gesture-handler';
|
import {TextInput} from 'react-native-gesture-handler';
|
||||||
import { Actions } from '../../provider/Actions';
|
import {Actions} from '../../provider/Actions';
|
||||||
import { DDS } from '../../services/DeviceDetection';
|
import {DDS} from '../../services/DeviceDetection';
|
||||||
import { eSendEvent, ToastEvent } from '../../services/EventManager';
|
import {eSendEvent, ToastEvent} from '../../services/EventManager';
|
||||||
import { getElevation } from '../../utils';
|
import {getElevation} from '../../utils';
|
||||||
import { db } from '../../utils/DB';
|
import {db} from '../../utils/DB';
|
||||||
import { eOnNewTopicAdded } from '../../utils/Events';
|
import {eOnNewTopicAdded} from '../../utils/Events';
|
||||||
import { ph, pv, SIZE, WEIGHT } from '../../utils/SizeUtils';
|
import {ph, pv, SIZE, WEIGHT} from '../../utils/SizeUtils';
|
||||||
import BaseDialog from '../Dialog/base-dialog';
|
import BaseDialog from '../Dialog/base-dialog';
|
||||||
import DialogButtons from '../Dialog/dialog-buttons';
|
import DialogButtons from '../Dialog/dialog-buttons';
|
||||||
|
import DialogContainer from '../Dialog/dialog-container';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../Dialog/dialog-header';
|
||||||
import { updateEvent } from '../DialogManager/recievers';
|
import {updateEvent} from '../DialogManager/recievers';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../Seperator';
|
||||||
import { Toast } from '../Toast';
|
import {Toast} from '../Toast';
|
||||||
|
|
||||||
export class AddTopicDialog extends React.Component {
|
export class AddTopicDialog extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -46,6 +47,7 @@ export class AddTopicDialog extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
async open() {
|
async open() {
|
||||||
|
console.log(this.props.notebookID);
|
||||||
this.notebook = await db.notebooks.notebook(this.props.notebookID);
|
this.notebook = await db.notebooks.notebook(this.props.notebookID);
|
||||||
this.setState({
|
this.setState({
|
||||||
visible: true,
|
visible: true,
|
||||||
@@ -70,36 +72,24 @@ export class AddTopicDialog extends React.Component {
|
|||||||
statusBarTranslucent={false}
|
statusBarTranslucent={false}
|
||||||
visible={true}
|
visible={true}
|
||||||
onRequestClose={this.close}>
|
onRequestClose={this.close}>
|
||||||
<View
|
<DialogContainer>
|
||||||
style={{
|
|
||||||
...getElevation(5),
|
|
||||||
width: DDS.isTab ? 350 : '80%',
|
|
||||||
maxHeight: 350,
|
|
||||||
borderRadius: 5,
|
|
||||||
backgroundColor: colors.bg,
|
|
||||||
paddingHorizontal: ph,
|
|
||||||
paddingVertical: pv,
|
|
||||||
}}>
|
|
||||||
<DialogHeader
|
<DialogHeader
|
||||||
icon="book-outline"
|
icon="book-outline"
|
||||||
title={toEdit ? 'Edit Topic' : 'New Topic'}
|
title={toEdit ? 'Edit Topic' : 'New Topic'}
|
||||||
paragraph={'Add a new topic to ' + this.notebook.title}
|
paragraph={'Add a new topic to ' + this.notebook.title}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Seperator />
|
|
||||||
|
|
||||||
<TextInput
|
<TextInput
|
||||||
ref={this.titleRef}
|
ref={this.titleRef}
|
||||||
style={{
|
style={{
|
||||||
padding: pv,
|
paddingTop: 10,
|
||||||
|
paddingBottom: 5,
|
||||||
borderBottomWidth: 1,
|
borderBottomWidth: 1,
|
||||||
borderColor: titleFocused ? colors.accent : colors.nav,
|
borderColor: titleFocused ? colors.accent : colors.nav,
|
||||||
paddingHorizontal: ph,
|
paddingHorizontal: 0,
|
||||||
borderRadius: 5,
|
|
||||||
fontSize: SIZE.sm,
|
fontSize: SIZE.sm,
|
||||||
fontFamily: WEIGHT.regular,
|
fontFamily: WEIGHT.regular,
|
||||||
color: colors.pri,
|
color: colors.pri,
|
||||||
marginTop: 20,
|
|
||||||
}}
|
}}
|
||||||
onFocus={() => {
|
onFocus={() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@@ -129,7 +119,7 @@ export class AddTopicDialog extends React.Component {
|
|||||||
}}
|
}}
|
||||||
onPressPositive={this.addNewTopic}
|
onPressPositive={this.addNewTopic}
|
||||||
/>
|
/>
|
||||||
</View>
|
</DialogContainer>
|
||||||
<Toast context="local" />
|
<Toast context="local" />
|
||||||
</BaseDialog>
|
</BaseDialog>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user