Skip to content

Commit

Permalink
chore: inline styles to improve readability, remove redundant label p…
Browse files Browse the repository at this point in the history
…rop #1883
  • Loading branch information
marek-mihok committed Mar 15, 2023
1 parent 7c99e75 commit 8550dc8
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions ui/src/copyable_text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,10 @@ const
position: 'relative'
}
}),
styles: Fluent.IStyle = {
fullHeightStyle: {
display: 'flex',
flexGrow: 1,
flexDirection: 'column',
},
textFieldRoot: {
position: 'relative',
width: pc(100)
},
textFieldMultiline: {
'&:hover button': {
opacity: 1
}
}
fullHeightStyle = {
display: 'flex',
flexGrow: 1,
flexDirection: 'column',
}

/**
Expand All @@ -68,7 +57,7 @@ export interface CopyableText {
export const XCopyableText = ({ model }: { model: CopyableText }) => {
const
{ name, multiline, label, value, height } = model,
heightStyle = multiline && height === '1' ? styles.fullHeightStyle : undefined,
heightStyle = multiline && height === '1' ? fullHeightStyle : undefined,
ref = React.useRef<Fluent.ITextField>(null),
timeoutRef = React.useRef<U>(),
[copied, setCopied] = React.useState(false),
Expand Down Expand Up @@ -96,7 +85,6 @@ export const XCopyableText = ({ model }: { model: CopyableText }) => {
data-test={name}
componentRef={ref}
value={value}
label={label}
multiline={multiline}
onRenderLabel={() =>
<div className={css.labelContainer}>
Expand All @@ -112,8 +100,8 @@ export const XCopyableText = ({ model }: { model: CopyableText }) => {
styles={{
root: {
...heightStyle,
...styles.textFieldRoot,
...multiline ? styles.textFieldMultiline : undefined
textFieldRoot: { position: 'relative', width: pc(100) },
textFieldMultiline: multiline ? { '&:hover button': { opacity: 1 } } : undefined
},
wrapper: heightStyle,
fieldGroup: heightStyle || { minHeight: height },
Expand Down

0 comments on commit 8550dc8

Please sign in to comment.