This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const activeBorderRadius = "1rem 1rem 0 0"; | |
const inactiveBorderRadius = "1rem 1rem 1rem 1rem"; | |
const InputContainer = styled.div` | |
border-radius: ${(props) => | |
props.hasText ? activeBorderRadius : inactiveBorderRadius}; | |
` | |
export const Autocomplete = () => { | |
const [hasText, setHasText] = useState(false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 위의 코드와 겹치는 부분은 생략 | |
const InputContainer = styled.div` | |
border-radius: ${inactiveBorderRadius}; | |
&.hasText { | |
border-radius: ${activeBorderRadius}; | |
} | |
` | |
export const Autocomplete = () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rotatedArraySearch = function (rotated, target) { | |
// rotated 배열의 최솟값 인덱스 구하기 | |
const smallest = rotated.findIndex((el) => el === Math.min(...rotated)); | |
const loop = function (min, max) { | |
while (min <= max) { | |
let middle = Math.floor((min + max) / 2); | |
let currentEl = rotated[middle]; | |
if (currentEl < target) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Tree { | |
constructor(value) { | |
this.value = value; | |
this.children = []; | |
} | |
insertNode(value) { | |
const childNode = new Tree(value); | |
this.children.push(childNode); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const balancedBrackets = function (str) { | |
const stack = []; | |
for (let i = 0; i < str.length; i++) { | |
const top = stack[stack.length - 1]; | |
switch (str[i]) { | |
case "[": | |
stack.push(str[i]); | |
break; | |
case "(": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const balancedBrackets = function (str) { | |
const stack = []; | |
const open = { | |
"[": "]", | |
"(": ")", | |
"{": "}", | |
}; | |
const close = "])}"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getDirections(matrix, from, to) { | |
// 1. from 노드를 start point로 BFS 순회 | |
// 2. 방문한 노드를 배열에 담아 트래킹하며, 해당 배열에 to 노드가 나오면 true 리턴 | |
// 3. BFS 순회를 마쳤는데 to 노드 안 나오면 false 리턴 | |
const queue = [from], | |
result = [], | |
visited = {}; | |
let currentVertex; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.container { | |
padding: 1rem 0; | |
display: grid; | |
grid-template-columns: repeat(12, 1fr); | |
grid-template-rows: repeat(2, 1fr); | |
gap: 1.5rem; | |
} | |
.mainItem { | |
grid-row: span 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.container { | |
padding: 1rem 0; | |
display: grid; | |
grid-template-columns: repeat(12, 1fr); | |
grid-template-rows: repeat(2, 1fr); | |
gap: 1.5rem; | |
} | |
/* 태블릿 분기 */ | |
@media screen and (max-width: 1024px) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// grid container component | |
const Section = styled.section` | |
padding: 1rem 0; | |
display: grid; | |
grid-template-columns: repeat(12, 1fr); | |
grid-template-rows: repeat(2, 1fr); | |
gap: 1.5rem; | |
@media screen and (max-width: 1024px) { | |
grid-template-rows: repeat(4, 1fr); | |
} |
OlderNewer