Skip to content

Commit 3e3645f

Browse files
committed
Add styling to Upload and Link
1 parent c2b9ae8 commit 3e3645f

File tree

4 files changed

+57
-17
lines changed

4 files changed

+57
-17
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ dist-ssr
2828

2929
# Licenses / secrets
3030
kendo-ui-license.txt
31+
32+
# Personal TODOs
33+
TODO.md

src/components/Button.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,6 @@ const Button = ({
586586
position: "absolute",
587587
top: 2,
588588
left: 0,
589-
...customStyles,
590-
...fontStyles
591589
}}
592590
>
593591
{Caption}
@@ -612,8 +610,6 @@ const Button = ({
612610
position: "absolute",
613611
top: 2,
614612
left: 16,
615-
...customStyles,
616-
...fontStyles
617613
}}
618614
>
619615
<label style={{whiteSpace: "nowrap"}} htmlFor={data?.ID}>{Caption}</label>

src/components/Link/index.jsx

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
1-
import { setStyle } from "../../utils";
1+
import { setStyle, getFontStyles, parseFlexStyles } from "../../utils";
2+
import { useAppData } from "../../hooks";
23

34
const Link = ({data}) => {
4-
const style = setStyle(data.Properties)
5+
const { findCurrentData, inheritedProperties } = useAppData();
6+
7+
const styles = setStyle(data?.Properties);
8+
const { CSS, Visible } = data?.Properties || {};
9+
const { FontObj } = inheritedProperties(data, 'FontObj');
10+
11+
const customStyles = parseFlexStyles(CSS);
12+
const font = findCurrentData(FontObj);
13+
const fontStyles = getFontStyles(font, 12);
14+
515
return (
6-
<div>
7-
<a
16+
<div
17+
id={data.ID + ".$CONTAINER"}
18+
style={{
19+
...styles,
20+
display: Visible === 0 ? "none" : "block",
21+
...customStyles,
22+
...fontStyles,
23+
}}
24+
>
25+
<a
826
id={data.ID}
9-
href={data.Properties.Href}
10-
target={data.Properties?.Target || '_blank'} // Default to new tab/window
27+
href={data.Properties?.Href}
28+
target={data.Properties?.Target || '_blank'}
1129
download={data.Properties?.Download === 1}
12-
13-
style={{
14-
...style
15-
}}
1630
>
17-
{data.Properties?.Label !== undefined ? data.Properties.Label : data.Properties.Href}
31+
{data.Properties?.Label !== undefined ? data.Properties.Label : data.Properties?.Href}
1832
</a>
1933
</div>
2034
);

src/components/Upload/index.jsx

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,36 @@
11
import wgResponse from "../../utils/wgResponse";
2+
import { setStyle, getFontStyles, parseFlexStyles } from "../../utils";
3+
import { useAppData } from "../../hooks";
24

35
const Upload = ({ data }) => {
6+
const { findCurrentData, inheritedProperties } = useAppData();
7+
8+
const styles = setStyle(data?.Properties);
9+
const { CSS, Visible } = data?.Properties || {};
10+
const { FontObj } = inheritedProperties(data, 'FontObj');
11+
12+
const customStyles = parseFlexStyles(CSS);
13+
const font = findCurrentData(FontObj);
14+
const fontStyles = getFontStyles(font, 12);
15+
416
return (
5-
<div>
6-
<input id={data.ID} type="file" />
17+
<div
18+
id={data.ID + ".$CONTAINER"}
19+
style={{
20+
...styles,
21+
display: Visible === 0 ? "none" : "block",
22+
...customStyles,
23+
...fontStyles,
24+
}}
25+
>
26+
<input
27+
id={data.ID}
28+
type="file"
29+
style={{
30+
width: "100%",
31+
height: "100%",
32+
}}
33+
/>
734
</div>
835
);
936
};

0 commit comments

Comments
 (0)