Skip to content

Commit

Permalink
general updates
Browse files Browse the repository at this point in the history
  • Loading branch information
aatmanvaidya committed Oct 10, 2023
1 parent 163b68e commit f76a735
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 53 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react'
import SlurCardBubble from './SlurCardBubble';
import {
Card, CardBody, CardFooter, CardHeader, List,
Text,
Box,
Button,
Anchor,
} from 'grommet';


const SlurCardComponent = ({ data }) => {
return (
<Card flex={true} background="#FFE5B4">
<CardHeader pad="medium">Header</CardHeader>
<CardBody pad="medium">Body</CardBody>
</Card>
)
}

export default SlurCardComponent
4 changes: 4 additions & 0 deletions browser-extension/plugin/src/ui-components/pages/Slur.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useNavigate } from 'react-router-dom';
import Api from './Api';
import { UserContext, NotificationContext } from '../atoms/AppContext';
import SlurCard from '../atoms/SlurCard';
import SlurCardComponent from '../atoms/SlurCardComponent';

const { getSlurAndCategory, deleteSlurAndCategory } = Api;

Expand Down Expand Up @@ -102,6 +103,9 @@ export function Slur() {
</Text>
</Box>
{getSlurs.map((slur, index) => (
// <Box key={index} margin={{top: "medium"}} align='center'>
// <SlurCardComponent data={slur} />
// </Box>
<Box
key={index}
// background="#fbeeac"
Expand Down
74 changes: 21 additions & 53 deletions browser-extension/plugin/src/ui-components/pages/SlurCreate.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
TextArea,
TextInput,
Anchor,
SelectMultiple
SelectMultiple,
RadioButton
} from 'grommet';
import { useNavigate } from 'react-router-dom';
import Api from './Api';
Expand Down Expand Up @@ -38,8 +39,8 @@ export function SlurCreate() {
label: '',
level_of_severity: '',
casual: undefined,
appropriated: false,
appropriationContext: false,
appropriated: undefined,
appropriationContext: undefined,
categories: [],
labelMeaning: ''
};
Expand Down Expand Up @@ -97,19 +98,16 @@ export function SlurCreate() {
setFormData(initialFormData);
setShowWarning(false);
};
const handleCasualChange = (value) => {
const casualValue = value ? 'Yes' : 'No';
setFormData({ ...formData, casual: casualValue });
};

return (
<Box>
<Anchor onClick={handleGoBack}>Go Back</Anchor>
<Box gap="medium">
{/* <Anchor onClick={handleGoBack}>Go Back</Anchor> */}
<Text size="large" alignSelf="center">
<strong>
<u>Add Slur</u>
</strong>
</Text>

<Form
value={formData}
onChange={(nextValue) => {
Expand Down Expand Up @@ -153,7 +151,7 @@ export function SlurCreate() {
/>
</FormField>

{/* <FormField name="casual" label={'Casual'} required>
<FormField name="casual" label={'Casual'} required>
<RadioButtonGroup
id="slur-form-casual"
name="casual"
Expand All @@ -163,73 +161,43 @@ export function SlurCreate() {
{ label: 'No', value: false }
]}
value={formData.casual}
onChange={(event) =>
handleCasualChange(event.target.value)
}
/>
</FormField> */}

<FormField name="casual" label={'Casual'} required>
<RadioButtonGroup
id="slur-form-casual"
name="casual"
direction="row"
options={['Yes', 'No']}
value={formData.casual ? 'Yes' : 'No'}
onChange={(e) =>
setFormData({
...formData,
casual: e.target.value === 'Yes'
})
}
/>
</FormField>

<FormField name="appropriated" label="Appropriated" required>
<FormField name="appropriated" label="Appropriated" required={false}>
<RadioButtonGroup
id="slur-form-appropriated"
name="appropriated"
direction="row"
options={['Yes', 'No']}
value={formData.appropriated ? 'Yes' : 'No'}
onChange={(e) =>
setFormData({
...formData,
appropriated: e.target.value === 'Yes'
})
}
options={[
{ label: 'Yes', value: true },
{ label: 'No', value: false }
]}
value={formData.appropriated}
/>
</FormField>

<FormField
name="appropriationContext"
label="If, Appropriated, Is it by Community or Others?"
// required={false}
// required={false}
>
<RadioButtonGroup
id="slur-form-appropriationContext"
name="appropriationContext"
direction="row"
options={['Community', 'Others']}
value={
formData.appropriationContext
? 'Community'
: 'Others'
}
onChange={(e) =>
setFormData({
...formData,
appropriationContext:
e.target.value === 'Community'
})
}
options={[
{ label: 'Community', value: true },
{ label: 'Others', value: false }
]}
value={formData.appropriationContext}
/>
</FormField>

<FormField
name="labelMeaning"
label="What Makes it Problematic?"
// required
// required
>
<TextArea
id="slur-form-label-meaning"
Expand Down

0 comments on commit f76a735

Please sign in to comment.