Skip to content

Commit

Permalink
UILD-446: Edit headers in full entity display screens (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
SKarolFolio authored Dec 26, 2024
1 parent 61f2c27 commit 7df749d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 29 deletions.
1 change: 1 addition & 0 deletions src/common/constants/uiControls.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const UI_DROPDOWNS_LIST = [AdvancedFieldType.dropdown, AdvancedFieldType.

export const NOT_PREVIEWABLE_TYPES = [
AdvancedFieldType.profile,
AdvancedFieldType.block,
AdvancedFieldType.hidden,
AdvancedFieldType.dropdownOption,
AdvancedFieldType.complex,
Expand Down
2 changes: 0 additions & 2 deletions src/components/FullDisplay/PreviewContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const PreviewContent = () => {

return previewContent.map(({ id, base, userValues, initKey, title, entities }) => {
const resourceType = entities?.map(e => RESOURCE_TEMPLATE_IDS[e])?.[0];
const resourceTypeWithFallback = resourceType ?? '-';
const handleButtonClick = () => setPreviewContent(previewContent.filter(entry => entry.id !== id));

return (
Expand All @@ -31,7 +30,6 @@ export const PreviewContent = () => {
</Button>
<div className="info">
<span className="title">{title}</span>
<span className="type">{resourceTypeWithFallback}</span>
</div>
<Button
data-testid="preview-fetch"
Expand Down
3 changes: 2 additions & 1 deletion src/components/Preview/Fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ export const Fields = ({
const entry = base.get(uuid);
const isOnBranchWithUserValue = paths.includes(uuid);
const isEntity = level === ENTITY_LEVEL;
const hasEmptyChildren = entry?.children?.every(id => !schema.get(id));

if (!entry) return null;
if (!entry || hasEmptyChildren) return null;

const { displayName = '', children, type, bfid = '', path, htmlId } = entry;
const isDependentDropdownOption =
Expand Down
1 change: 0 additions & 1 deletion src/components/Preview/Labels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ export const Labels: FC<LabelProps> = ({
return (
<strong
className={classNames({
'entity-heading': isEntity,
'sub-heading': isBlock,
'value-heading': !isGroupable,
})}
Expand Down
25 changes: 2 additions & 23 deletions src/components/Preview/Preview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
.preview-entity {
max-width: 560px;
width: 100%;

&:not(:last-child) {
border-right: 1px solid rgba(0, 0, 0, 0.1);
padding-right: 0.938rem;
Expand Down Expand Up @@ -42,27 +42,6 @@
}
}

.entity-heading {
display: flex;
align-items: center;
gap: 0.313rem;
font-size: 1.138rem;
padding-bottom: 0.5rem;

.toggle-entity-edit {
margin-left: auto;
}

> svg {
height: 1.25rem;
width: 1.25rem;

& * {
fill: #00000099;
}
}
}

.value-heading {
padding-bottom: 0.219rem;
}
Expand Down Expand Up @@ -109,7 +88,7 @@
}

span {
color: rgba(0, 0, 0, 0.6)
color: rgba(0, 0, 0, 0.6);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/test/__tests__/components/FullDisplay.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ describe('FullDisplay', () => {
);
});

const { getByTestId, getAllByTestId, getByText } = screen;
const { getByTestId, getAllByTestId } = screen;

test('contains preview container and header', () => {
expect(getByTestId('preview-contents-container')).toBeInTheDocument();
expect(getByText('Work')).toBeInTheDocument();
});

test('removes a preview content entry on close button click', () => {
Expand Down

0 comments on commit 7df749d

Please sign in to comment.