-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4104 from AriGunawan/feature/add_support_for_choi…
…ce_and_date
- Loading branch information
Showing
11 changed files
with
96 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v16.13.0 | ||
v14.15.0 |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
34 changes: 34 additions & 0 deletions
34
...t-enhanced-page-properties/src/webparts/enhancedPageProperties/components/Value/Value.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,34 @@ | ||
import { IFieldInfo } from "@pnp/sp/fields"; | ||
import { format } from "date-fns"; | ||
import * as React from "react"; | ||
import styles from "../EnhancedPageProperties.module.scss"; | ||
|
||
export interface IValueProps { | ||
field: IFieldInfo; | ||
value: string | string[]; | ||
} | ||
|
||
export default function Value(props: IValueProps): JSX.Element { | ||
if (!props.value) return <span>-</span>; | ||
|
||
switch (props.field.TypeDisplayName) { | ||
case "Choice": { | ||
const value = props.value as string[]; | ||
return ( | ||
<div className={styles.choice}> | ||
{value.map((item: string) => ( | ||
<span key={item}>{item}</span> | ||
))} | ||
</div> | ||
); | ||
} | ||
case "Date and Time": { | ||
return ( | ||
<span>{format(new Date(props.value as string), "dd MMMM yyyy")}</span> | ||
); | ||
} | ||
default: { | ||
return <span>{props.value}</span>; | ||
} | ||
} | ||
} |