Skip to content

Commit 8c1d446

Browse files
feat: add components to examples folder and its style files (#29)
1 parent cb659ac commit 8c1d446

23 files changed

+1617
-44
lines changed

example/src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import React, { useState } from "react";
22

33
import { DeleteIcon, EditIcon } from "../../src/components/icons";
44
import { MultiLevelTable } from "../../src/components/MultiLevelTable";
5-
import { Popup } from "../../src/components/Popup";
6-
import { RowDetailsPopup } from "../../src/components/RowDetailsPopup";
7-
import { SidePanel } from "../../src/components/SidePanel";
5+
import { Popup } from "./components/Popup";
6+
import { RowDetailsPopup } from "./components/RowDetailsPopup";
7+
import { SidePanel } from "./components/SidePanel";
88
import { getStatusStyle, tableRowTypography } from "../../src/styles/style";
99
import { darkTheme, lightTheme } from "../../src/themes";
1010
import type { ThemeProps } from "../../src/types/theme";
File renamed without changes.
File renamed without changes.

src/components/RowDetailsPopup.tsx renamed to example/src/components/RowDetailsPopup.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import React, { useEffect } from 'react';
22

33
import { DetailRow } from './DetailRow';
4-
import { getStatusStyle, tableRowTypography } from '../styles/style';
5-
import type { ThemeProps } from '../types/theme';
64
import type { DataItem } from '../types/types';
7-
5+
import type { ThemeProps } from '../types/theme';
6+
import { getStatusStyle, tableRowTypography } from '../styles/style';
87
import '../styles/RowDetailsPopup.css';
98

109
interface RowDetailsPopupProps {

src/components/SidePanel.tsx renamed to example/src/components/SidePanel.tsx

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import React, { useEffect, useState } from 'react';
1+
import React, { useState, useEffect } from 'react';
22

33
import { SidePanelInput } from './SidePanelInput';
4-
import { createComponentStyles } from '../styles/componentStyles';
5-
import { getStatusStyle } from '../styles/style';
6-
import type { ThemeProps } from '../types/theme';
74
import type { DataItem } from '../types/types';
8-
5+
import type { ThemeProps } from '../types/theme';
6+
import { componentStyles, getStatusStyle } from '../styles/style';
97
import '../styles/SidePanel.css';
108

119
interface SidePanelProps {
@@ -31,7 +29,6 @@ export const SidePanel: React.FC<SidePanelProps> = ({
3129
isStatusEditable = false, // Status is typically not editable
3230
}) => {
3331
const [formData, setFormData] = useState<Partial<DataItem>>({});
34-
const styles = createComponentStyles(theme);
3532

3633
// Prevent body scroll when side panel is open
3734
useEffect(() => {
@@ -89,7 +86,7 @@ export const SidePanel: React.FC<SidePanelProps> = ({
8986

9087
return (
9188
<span style={{
92-
...styles.statusBadge.base,
89+
...componentStyles.statusBadge.base,
9390
...style
9491
}}>
9592
{status}
@@ -104,22 +101,22 @@ export const SidePanel: React.FC<SidePanelProps> = ({
104101
const firstLetter = value.charAt(0).toUpperCase();
105102

106103
return (
107-
<div style={styles.resourceTypeDisplay.container}>
104+
<div style={componentStyles.resourceTypeDisplay.container}>
108105
<div style={{
109-
...styles.resourceTypeDisplay.icon,
110-
...(imageURL ? styles.resourceTypeDisplay.iconWithImage : styles.resourceTypeDisplay.iconWithoutImage)
106+
...componentStyles.resourceTypeDisplay.icon,
107+
...(imageURL ? componentStyles.resourceTypeDisplay.iconWithImage : componentStyles.resourceTypeDisplay.iconWithoutImage)
111108
}}>
112109
{imageURL ? (
113110
<img
114111
src={imageURL}
115112
alt={value}
116-
style={styles.resourceTypeDisplay.image}
113+
style={componentStyles.resourceTypeDisplay.image}
117114
/>
118115
) : (
119116
firstLetter
120117
)}
121118
</div>
122-
<span style={styles.resourceTypeDisplay.text}>{value}</span>
119+
<span style={componentStyles.resourceTypeDisplay.text}>{value}</span>
123120
</div>
124121
);
125122
};
@@ -130,36 +127,36 @@ export const SidePanel: React.FC<SidePanelProps> = ({
130127
<div
131128
className="side-panel-overlay"
132129
onClick={onClose}
133-
style={styles.sidePanel.overlay}
130+
style={componentStyles.sidePanel.overlay}
134131
/>
135132

136133
{/* Side Panel */}
137134
<div
138135
className="side-panel"
139136
style={{
140-
...styles.sidePanel.container,
137+
...componentStyles.sidePanel.container,
141138
transform: isOpen ? 'translateX(0)' : 'translateX(100%)',
142139
transition: 'transform 0.3s ease-in-out',
143140
}}
144141
>
145142
{/* Header */}
146-
<div style={styles.sidePanel.header}>
147-
<h2 style={styles.sidePanel.title}>
143+
<div style={componentStyles.sidePanel.header}>
144+
<h2 style={componentStyles.sidePanel.title}>
148145
Resource Details
149146
</h2>
150147
<button
151148
onClick={onClose}
152-
style={styles.sidePanel.closeButton}
149+
style={componentStyles.sidePanel.closeButton}
153150
>
154151
×
155152
</button>
156153
</div>
157154

158155
{/* Content */}
159-
<div style={styles.sidePanel.content}>
156+
<div style={componentStyles.sidePanel.content}>
160157
{/* Resource Type */}
161-
<div style={styles.sidePanel.fieldContainer}>
162-
<label style={styles.sidePanel.label}>
158+
<div style={componentStyles.sidePanel.fieldContainer}>
159+
<label style={componentStyles.sidePanel.label}>
163160
Resource Type
164161
</label>
165162
<ResourceTypeDisplay
@@ -169,11 +166,11 @@ export const SidePanel: React.FC<SidePanelProps> = ({
169166
</div>
170167

171168
{/* ID */}
172-
<div style={styles.sidePanel.fieldContainer}>
173-
<label style={styles.sidePanel.label}>
169+
<div style={componentStyles.sidePanel.fieldContainer}>
170+
<label style={componentStyles.sidePanel.label}>
174171
ID *
175172
</label>
176-
<div style={styles.sidePanel.idField}>
173+
<div style={componentStyles.sidePanel.idField}>
177174
{item.id}
178175
</div>
179176
</div>
@@ -199,8 +196,8 @@ export const SidePanel: React.FC<SidePanelProps> = ({
199196
/>
200197

201198
{/* Status */}
202-
<div style={styles.sidePanel.fieldContainer}>
203-
<label style={styles.sidePanel.label}>
199+
<div style={componentStyles.sidePanel.fieldContainer}>
200+
<label style={componentStyles.sidePanel.label}>
204201
Status
205202
</label>
206203
{isStatusEditable ? (
@@ -229,13 +226,13 @@ export const SidePanel: React.FC<SidePanelProps> = ({
229226
</div>
230227

231228
{/* Footer with Save Changes Button */}
232-
<div style={styles.sidePanel.footer}>
229+
<div style={componentStyles.sidePanel.footer}>
233230
<button
234231
onClick={handleSaveChanges}
235232
disabled={!hasChanges}
236233
style={{
237-
...styles.sidePanel.saveButton,
238-
...(hasChanges ? styles.sidePanel.saveButtonEnabled : styles.sidePanel.saveButtonDisabled),
234+
...componentStyles.sidePanel.saveButton,
235+
...(hasChanges ? componentStyles.sidePanel.saveButtonEnabled : componentStyles.sidePanel.saveButtonDisabled),
239236
}}
240237
onMouseEnter={(e) => {
241238
if (hasChanges)

src/components/SidePanelInput.tsx renamed to example/src/components/SidePanelInput.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react';
22

33
import type { ThemeProps } from '../types/theme';
4-
54
import '../styles/SidePanelInput.css';
65

76
interface SidePanelInputProps {

example/src/styles/ExportDropdown.css

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.export-dropdown {
2+
position: absolute;
3+
top: calc(100% + 8px);
4+
right: 0;
5+
min-width: 180px;
6+
background-color: #ffffff;
7+
border: 1px solid #F0F0F0;
8+
border-radius: 8px;
9+
box-shadow: 0px 0px 1px 0px #00000033, 0px 8px 24px -6px #00000014;
10+
z-index: 1000;
11+
overflow: hidden;
12+
font-family: 'DM Sans', sans-serif;
13+
}
14+
15+
.export-dropdown-content {
16+
padding: 8px 0;
17+
}
18+
19+
.export-option {
20+
display: flex;
21+
align-items: center;
22+
width: 100%;
23+
padding: 12px 16px;
24+
background: none;
25+
border: none;
26+
cursor: pointer;
27+
gap: 12px;
28+
transition: background-color 0.2s ease;
29+
font-family: 'DM Sans', sans-serif;
30+
font-size: 14px;
31+
font-weight: 500;
32+
text-align: left;
33+
}
34+
35+
.export-option:hover {
36+
background-color: #f5f5f5;
37+
}
38+
39+
.export-icon {
40+
font-size: 16px;
41+
width: 20px;
42+
text-align: center;
43+
}

0 commit comments

Comments
 (0)