Skip to content

Commit 6cb6d72

Browse files
committed
ts ref\
1 parent 31e18ed commit 6cb6d72

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

packages/app/src/app/pages/common/Modals/ShareModal2/elements.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import styled from 'styled-components';
1+
import styled, {
2+
StyledComponent,
3+
StyledComponentInnerOtherProps,
4+
} from 'styled-components';
25
import css from '@styled-system/css';
36

47
export const Container = styled.div(
@@ -109,13 +112,17 @@ export const Input = styled.input<{ code?: boolean }>(({ code }) =>
109112
})
110113
);
111114

112-
export const TextArea = styled(Input)(
115+
export const TextArea = styled(Input).attrs({ as: 'textarea' })(
113116
css({
114117
height: 'auto', // let rows attr take care of height
115118
lineHeight: 1.6,
116119
marginBottom: 2,
117120
})
118-
);
121+
) as StyledComponent<
122+
'textarea',
123+
any,
124+
StyledComponentInnerOtherProps<typeof Input>
125+
>;
119126

120127
export const Button = styled.button(
121128
css({

packages/app/src/app/pages/common/Modals/ShareModal2/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function ShareModal() {
122122
};
123123

124124
/** Copy Embed code */
125-
const urlContainer = React.useRef();
125+
const urlContainer = React.useRef<HTMLInputElement | null>(null);
126126
const [copied, setCopied] = React.useState(false);
127127

128128
const copyEmbedCode = () => {
@@ -256,9 +256,8 @@ function ShareModal() {
256256
</Section>
257257
<SectionBody>
258258
<TextArea
259-
as="textarea"
260259
code
261-
rows="5"
260+
rows={5}
262261
readOnly
263262
value={getUrl(settings, darkMode)}
264263
ref={urlContainer}

0 commit comments

Comments
 (0)