Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Replace style prop with utility css classes in frontend/src/lib #23072

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
655b549
Issue 16826: Replace style prop with utility css classes - frontend/s…
Dejvino Jun 19, 2024
b27aea7
Issue 16826: Replace style prop with utility css classes - frontend/s…
Dejvino Jun 20, 2024
144c4c7
Merge remote-tracking branch 'refs/remotes/origin/master' into issue-…
Dejvino Jun 20, 2024
ddac764
Update frontend/src/lib/components/CommandBar/index.scss
Dejvino Jun 21, 2024
f21e673
Merge branch 'master' into issue-16826-lib
Dejvino Jun 21, 2024
03362d3
Merge branch 'refs/heads/master' into issue-16826-lib
Dejvino Jun 24, 2024
37a924a
Prettier fix of frontend/src/lib/components/CommandBar/index.scss
Dejvino Jun 24, 2024
961663a
Merge branch 'refs/heads/master' into issue-16826-lib
Dejvino Jun 24, 2024
4687eba
Merge remote-tracking branch 'refs/remotes/upstream/master' into issu…
Dejvino Jun 25, 2024
9ed3e1e
Merge branch 'master' into issue-16826-lib
daibhin Jun 25, 2024
a8da267
Merge remote-tracking branch 'refs/remotes/upstream/master' into issu…
Dejvino Jun 26, 2024
18fe44a
Merge branch 'master' into issue-16826-lib
Dejvino Jul 11, 2024
c95d942
Merge branch 'master' into issue-16826-lib
Dejvino Jul 14, 2024
1cf9cce
Fix CommandBar snapshot tests by adding fixed class
Dejvino Jul 14, 2024
a062993
Update snapshots for CompactList
Dejvino Jul 14, 2024
7a75a58
Update snapshots for LemonCalendar
Dejvino Jul 14, 2024
6590546
Merge branch 'master' into issue-16826-lib
Dejvino Jul 16, 2024
b73c927
Merge branch 'master' into issue-16826-lib
Dejvino Jul 17, 2024
6f2b801
Merge branch 'master' into issue-16826-lib
Dejvino Jul 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ export const InsightCard: Story = (args) => {
const [wasItemRemoved, setWasItemRemoved] = useState(false)

return (
// eslint-disable-next-line react/forbid-dom-props
<div style={{ display: 'grid', gap: '1rem', gridTemplateColumns: 'repeat(2, 1fr)', minWidth: '50rem' }}>
<div className="grid gap-4 grid-cols-2 min-w-[50rem]">
{!wasItemRemoved && (
<InsightCardComponent
insight={
Expand Down Expand Up @@ -194,8 +193,7 @@ export const InsightCard: Story = (args) => {

export const QueryInsightCard: Story = (args) => {
return (
// eslint-disable-next-line react/forbid-dom-props
<div style={{ display: 'grid', gap: '1rem', gridTemplateColumns: 'repeat(2, 1fr)', minWidth: '50rem' }}>
<div className="grid gap-4 grid-cols-2 min-w-[50rem]">
{examples.map((insight) => {
// turn into HogQL based insight
if (!insight.filters.insight || insight.query) {
Expand Down
12 changes: 2 additions & 10 deletions frontend/src/lib/components/CommandBar/CommandBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,8 @@ const CommandBarOverlay = forwardRef<HTMLDivElement, CommandBarOverlayProps>(fun
ref
): JSX.Element {
return (
<div
className="fixed top-0 left-0 w-full h-full flex flex-col items-center justify-center p-3"
// eslint-disable-next-line react/forbid-dom-props
style={{
zIndex: 'var(--z-command-palette)',
backgroundColor: 'var(--modal-backdrop-color)',
backdropFilter: 'blur(var(--modal-backdrop-blur))',
}}
>
<div className="w-full h-full max-h-160 max-w-248 overflow-hidden">
<div className="CommandBar__overlay fixed">
<div className="CommandBar__overlay-content">
<div
data-attr="command-bar"
className={`w-full ${
Expand Down
24 changes: 24 additions & 0 deletions frontend/src/lib/components/CommandBar/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,27 @@
// offset container height by input
height: calc(100% - 2.875rem);
}

.CommandBar__overlay {
position: fixed;
top: 0;
left: 0;
z-index: var(--z-command-palette);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
padding: 0.75rem;
background-color: var(--modal-backdrop-color);
backdrop-filter: blur(var(--modal-backdrop-blur));

&-content {
width: 100%;
max-width: 62rem;
height: 100%;
max-height: 40rem;
overflow: hidden;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ export default meta
export function CompactList_({ loading }: { loading: boolean }): JSX.Element {
return (
<div className="flex">
{/* eslint-disable-next-line react/forbid-dom-props */}
<div style={{ width: 350 }}>
<div className="w-80">
<CompactList
loading={loading}
title="Recent persons"
Expand All @@ -44,8 +43,7 @@ export function CompactList_({ loading }: { loading: boolean }): JSX.Element {
)}
/>
</div>
{/* eslint-disable-next-line react/forbid-dom-props */}
<div style={{ width: 350, marginLeft: 30 }}>
<div className="w-80 ml-8">
<CompactList
loading={loading}
title="Recordings"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ export function RollingDateRangeFilter({
<p className="RollingDateRangeFilter__label">{dateRangeFilterLabel}</p>
<div className="RollingDateRangeFilter__counter" onClick={(e): void => e.stopPropagation()}>
<span
className="RollingDateRangeFilter__counter__step cursor-pointer"
// eslint-disable-next-line react/forbid-dom-props
style={{ background: 'none' }}
className="RollingDateRangeFilter__counter__step cursor-pointer bg-transparent"
onClick={decreaseCounter}
title="Decrease rolling date range"
>
Expand All @@ -79,9 +77,7 @@ export function RollingDateRangeFilter({
onChange={(value) => setCounter(value)}
/>
<span
className="RollingDateRangeFilter__counter__step cursor-pointer"
// eslint-disable-next-line react/forbid-dom-props
style={{ background: 'none' }}
className="RollingDateRangeFilter__counter__step cursor-pointer bg-transparent"
onClick={increaseCounter}
title="Increase rolling date range"
>
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/lib/components/DebugNotice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,7 @@ export function DebugNotice(): JSX.Element | null {
)
}
return (
<div
className="border rounded bg-bg-3000 overflow-hidden mb-1.5 w-full font-mono max-w-60"
// eslint-disable-next-line react/forbid-dom-props
style={{ fontSize: 13 }} // utility classes don't have a 13px variant
>
<div className="border rounded bg-bg-3000 overflow-hidden mb-1.5 w-full font-mono max-w-60 text-[13px]">
<div className="flex items-center gap-2 px-2 h-8 border-l-4 border-brand-blue justify-between">
<b>DEBUG mode</b>
<LemonButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ export default meta

export const TheHedgehog: StoryFn<typeof MyHedgehogBuddy> = () => {
return (
// eslint-disable-next-line react/forbid-dom-props
<div style={{ height: 200 }}>
<div className="h-52">
<MyHedgehogBuddy
onClose={() => {
// eslint-disable-next-line no-console
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ const BasicTemplate: StoryFn<typeof LemonCalendarSelect> = (props: LemonCalendar
const [granularity, setGranularity] = useState<LemonCalendarSelectProps['granularity']>(props.granularity)

return (
// eslint-disable-next-line react/forbid-dom-props
<div style={{ paddingBottom: 500 }}>
<div className="pb-[30rem]">
<Popover
actionable
overlay={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ const BasicTemplate: StoryFn<typeof LemonCalendarRange> = (props: LemonCalendarR
const [visible, setVisible] = useState(true)

return (
// eslint-disable-next-line react/forbid-dom-props
<div style={{ paddingBottom: 500 }}>
<div className="pb-[30rem]">
<Popover
actionable
overlay={
Expand Down
Loading