Skip to content

Commit

Permalink
chore: License tab -> stockImg tab (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
heeoneie authored Dec 3, 2023
1 parent f4ce82e commit 0ed7069
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 562 deletions.
2 changes: 0 additions & 2 deletions src/component/order/editor/icons/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ import Uploads from './Uploads';
import SwapHorizontal from './SwapHorizontal';
import Layers from './Layers';
import AI from './AI';
import License from './License';
import Text from './Text';
class Icons {
static Images = Images;
static Uploads = Uploads;
static Customize = SwapHorizontal;
static Layers = Layers;
static AI = AI;
static License = License;
static Text = Text;
}

Expand Down
5 changes: 0 additions & 5 deletions src/component/order/editor/panels/PanelsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ const BASE_ITEMS = [
name: 'AI',
label: 'AI',
},
{
id: 'license',
name: 'License',
label: '라이센스',
},
{
id: 'text',
name: 'Text',
Expand Down
43 changes: 30 additions & 13 deletions src/component/order/editor/panels/panelItems/Images.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
import React from 'react';
import { useStyletron } from 'baseui';
import { Block } from 'baseui/block';
import { images } from '../../../../../constants/mock-data';
import useSidebarOpen from '../../../../../hooks/useSidebarOpen';
import AngleDoubleLeft from '../../icons/AngleDoubleLeft';
import { useCallback, useEffect, useState } from 'react';
import { getLicenseList } from '../../../../../axios/order/editor/License';
import { useEditor } from '@layerhub-io/react';
import Scrollable from '../../common/Scrollable';
import AngleDoubleLeft from '../../icons/AngleDoubleLeft';
import useSidebarOpen from '../../../../../hooks/useSidebarOpen';
import { useStyletron } from 'baseui';

const Images = () => {
const editor = useEditor();
const License = () => {
const { setIsSidebarOpen } = useSidebarOpen();
const [licenses, setLicenses] = useState([]);
const editor = useEditor();

useEffect(() => {
getLicense();
}, []);

const getLicense = () => {
getLicenseList().then((res) => {
setLicenses(res.data);
});
};

const addObject = React.useCallback(
const addObject = useCallback(
async (url) => {
if (editor) {
const options = {
Expand Down Expand Up @@ -46,13 +57,19 @@ const Images = () => {
</Block>
<Scrollable>
<Block padding='0 1.5rem'>
<div style={{ display: 'grid', gap: '8px', gridTemplateColumns: '1fr 1fr' }}>
{images.map((image, index) => {
<div
style={{
display: 'grid',
gap: '8px',
gridTemplateColumns: '1fr 1fr',
}}
>
{licenses.map((license, index) => {
return (
<ImageItem
key={index}
onClick={() => addObject(image.src.large)}
preview={image.src.small}
onClick={() => addObject(license.imageUrl)}
preview={license.imageUrl}
/>
);
})}
Expand Down Expand Up @@ -127,4 +144,4 @@ const ImageItem = ({ preview, onClick }) => {
);
};

export default Images;
export default License;
147 changes: 0 additions & 147 deletions src/component/order/editor/panels/panelItems/License.js

This file was deleted.

2 changes: 0 additions & 2 deletions src/component/order/editor/panels/panelItems/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import Uploads from './Uploads';
import Images from './Images';
import Layers from './Layers';
import AI from './AI';
import License from './License';
import Text from './Text';
export default {
Customize,
Uploads,
Images,
Layers,
AI,
License,
Text,
};
Loading

0 comments on commit 0ed7069

Please sign in to comment.