Skip to content

Commit

Permalink
refactor: move common styles to conditional sortable element
Browse files Browse the repository at this point in the history
  • Loading branch information
navinkarkera committed Jan 17, 2024
1 parent 828eea3 commit 652f4ad
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
13 changes: 11 additions & 2 deletions src/course-outline/drag-helper/ConditionalSortableElement.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,20 @@ const ConditionalSortableElement = ({
children,
componentStyle,
}) => {
const style = {
background: 'white',
padding: '1rem 1.5rem',
marginBottom: '1.5rem',
borderRadius: '0.35rem',
boxShadow: '0 0 .125rem rgba(0, 0, 0, .15), 0 0 .25rem rgba(0, 0, 0, .15)',
...componentStyle,
};

if (draggable) {
return (
<SortableItem
id={id}
componentStyle={componentStyle}
componentStyle={style}
>
<div className="extend-margin">
{children}
Expand All @@ -24,7 +33,7 @@ const ConditionalSortableElement = ({
return (
<Row
data-testid="conditional-sortable-element--no-drag-handle"
style={componentStyle}
style={style}
className="mx-0"
>
{children}
Expand Down
4 changes: 0 additions & 4 deletions src/course-outline/section-card/SectionCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,7 @@ const SectionCard = ({
id={id}
draggable={actions.draggable}
componentStyle={{
background: 'white',
padding: '1.75rem',
marginBottom: '1.5rem',
borderRadius: '0.35rem',
boxShadow: '0 0 .125rem rgba(0, 0, 0, .15), 0 0 .25rem rgba(0, 0, 0, .15)',
...borderStyle,
}}
>
Expand Down
4 changes: 0 additions & 4 deletions src/course-outline/subsection-card/SubsectionCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ const SubsectionCard = ({
}
componentStyle={{
background: '#f8f7f6',
padding: '1rem 1.5rem',
marginBottom: '1.5rem',
borderRadius: '0.35rem',
boxShadow: '0 0 .125rem rgba(0, 0, 0, .15), 0 0 .25rem rgba(0, 0, 0, .15)',
...borderStyle,
}}
>
Expand Down
4 changes: 0 additions & 4 deletions src/course-outline/unit-card/UnitCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ const UnitCard = ({
draggable={false} // update to {actions.draggable} when unit drag-n-drop is implemented
componentStyle={{
background: '#fdfdfd',
padding: '1rem 1.5rem',
marginBottom: '1.5rem',
borderRadius: '0.35rem',
boxShadow: '0 0 .125rem rgba(0, 0, 0, .15), 0 0 .25rem rgba(0, 0, 0, .15)',
...borderStyle,
}}
>
Expand Down

0 comments on commit 652f4ad

Please sign in to comment.