-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Abstracted button control panel from Group.tsx to its own file and styled some components in edit mode, specifically temporary elements but also the button container.
- Loading branch information
Showing
7 changed files
with
135 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
client/src/components/templates/content_rendering/GroupButtonPanel.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
.GroupButtonContainer { | ||
display: grid; | ||
justify-content: center; | ||
} | ||
|
||
.GroupButtonContainer div { | ||
margin: 0.25rem 0; | ||
} | ||
|
||
.GroupButtonContainer div button { | ||
margin: 0.1rem | ||
} | ||
|
||
.GroupButtonContainerNewContent { | ||
|
||
} | ||
|
||
.GroupButtonContainerOptions { | ||
display: flex; | ||
justify-content: center; | ||
} | ||
|
||
.GroupButtonContainerDeleteGroup { | ||
display: flex; | ||
justify-content: center; | ||
} |
71 changes: 71 additions & 0 deletions
71
client/src/components/templates/content_rendering/GroupButtonPanel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import React from 'react' | ||
import GroupForm from './GroupForm' | ||
import { v4 as uuid } from "uuid" | ||
import { deleteGroup, onSubmitGroup, updateGroup } from 'functions/contentRequests' | ||
import { ContentType } from 'components/utilities/contentTypes' | ||
import "./GroupButtonPanel.css" | ||
|
||
export default function GroupButtonPanel(props: PropForComponent) { | ||
return ( | ||
<div className="GroupButtonContainer"> | ||
<div className="GroupButtonContainerNewContent"> | ||
<button onClick={() => props.setNewElement({ parentGroup: props.group._id, type: ContentType.TEXT })}>Add text</button> | ||
<button onClick={() => props.setNewElement({ parentGroup: props.group._id, type: ContentType.LINK })}>Add link</button> | ||
<button onClick={() => props.setNewElement({ parentGroup: props.group._id, type: ContentType.DEADLINE })}>Add deadline</button> | ||
<GroupForm | ||
key={uuid()} | ||
forRoot={false} | ||
parentId={props.group._id} | ||
newGroup={props.newGroup} | ||
createGroup={(isSubGroup: boolean) => props.setNewGroup({ | ||
parentGroup: props.group._id, | ||
name: "", | ||
isSubGroup: isSubGroup | ||
})} | ||
submitGroup={(name) => onSubmitGroup(name, props.newGroup, props.fingerprint)} | ||
/> | ||
</div> | ||
<div className="GroupButtonContainerOptions"> | ||
<button onClick={() => | ||
updateGroup( | ||
props.group._id, | ||
"split", | ||
!props.group.split, | ||
props.fingerprint!)} | ||
>{props.group.split ? "Disable" : "Enable"} split</button> | ||
<button onClick={() => | ||
updateGroup( | ||
props.group._id, | ||
"column", | ||
!props.group.column, | ||
props.fingerprint!)} | ||
>{props.group.column ? "Disable" : "Enable"} column</button> | ||
</div> | ||
{props.group.depth > 1 ? | ||
<div className="GroupButtonContainerDeleteGroup"> | ||
<button onClick={() => deleteGroup(props.group._id, props.fingerprint)}>Delete this group</button> | ||
</div> : null | ||
} | ||
</div> | ||
) | ||
} | ||
|
||
interface PropForComponent { | ||
group: Group, | ||
fingerprint: string, | ||
newGroup?: { | ||
parentGroup: string, | ||
name: string, | ||
isSubGroup: boolean | ||
}, | ||
updateGroup: (id: string, setting: "split" | "column" | "placement", value: number | boolean, fingerprint: string) => void, | ||
setNewElement: (data: { | ||
parentGroup: string, | ||
type: ContentType | ||
}) => void, | ||
setNewGroup: (data: { | ||
parentGroup: string, | ||
name: string, | ||
isSubGroup: boolean | ||
}) => void | ||
} |
10 changes: 0 additions & 10 deletions
10
client/src/components/templates/content_rendering/RenderData.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
client/src/components/templates/content_rendering/TemporaryFields.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.tempNewFieldsWrapper { | ||
width: 100%; | ||
} | ||
|
||
.tempNewFieldsContainer { | ||
display: grid; | ||
margin: 0 auto; | ||
max-width: 10rem; | ||
} | ||
|
||
.temporaryLabel { | ||
color: #fff; | ||
} | ||
|
||
.temporaryField::placeholder { | ||
color: #fff; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters