Designing a logical function for quantum computer is similar to same process for classical one. You can also use truth tables. But you have to design the function to be reversible. Assume you have truth table for logical function $f(x): \{0;1\}^n \rightarrow \{0,1\}$, then reversible equivalent can be build in this way:
$$
|x_n\rangle |y\rangle \rightarrow |x_n\rangle |f(x_n) \oplus y\rangle.
$$
You should do this for all basis quantum states. Then arrange mapping you got to a matrix. Because of construction above, the matrix is unitary. After that you have to decompose the matrix to some basic gates.
Any unitary 2x2 matrix (i.e. single qubit gate) can be decomposed into three matrices
$$
\begin{pmatrix}
\mathrm{e}^{i\alpha} & 0\\
0 & \mathrm{e}^{-i\alpha}\
\end{pmatrix}
\begin{pmatrix}
\cos (\theta/2) & \sin(\theta/2)\\
-\sin (\theta/2) & \cos (\theta/2)
\end{pmatrix}
\begin{pmatrix}
\mathrm{e}^{i\beta} & 0\\
0 & \mathrm{e}^{-i\beta}\
\end{pmatrix},
$$
$\alpha, \beta$ and $\theta$ being real numbers.
When you single out $\mathrm{e}^{i\alpha}$ from the first matrix and $\mathrm{e}^{i\beta}$ from the third, you get $U1$ gate (up to global phase) on IBM Q. A matrix in the middle can be implemented with gate $U3$ on IBM Q (or $y$ rotation up to phase). So, this is a universal approach how to build single qubit gate.
Any contolled gate (with one control qubit) can be decomposed to
$$
(I\otimes C) \,CNOT\, (I \otimes B)\, CNOT\, (I \otimes A),
$$
where $I$ is and 2x2 unit matrix and $ABC = I$.
See Elementary gates for quantum computation for more information on three and more qubits gates.
Also these articles could be helpful: